Python Crash Course by ehmatthes (2024)

Resources for the second edition are here. I'd love to know what you think about Python Crash Course; please consider taking a brief survey. If you'd like to know when additional resources are available, you can sign up for email notifications here.

Pip is a special program used to install Python packages to your system. Pip is sometimes included automatically when Python is installed to your system, and sometimes you have to install it yourself. These instructions will help you check if pip is on your system, and help you upgrade or install it if necessary.

  • Pip on Linux
    • Checking for pip on Linux
    • Installing pip on Linux
    • Upgrading pip on Linux
    • Installing Python packages with pip on Linux
    • Uninstalling packages with pip on Linux
  • Pip on OS X
    • Checking for pip on OS X
    • Installing pip on OS X
    • Upgrading pip on OS X
    • Installing Python packages with pip on OS X
    • Uninstalling packages with pip on OS X
  • Pip on Windows
    • Checking for pip on Windows
    • Installing pip on Windows
    • Upgrading pip on Windows
    • Installing Python packages with pip on Windows
    • Uninstalling packages with pip on Windows

Pip on Linux

Checking for pip on Linux

First, check whether pip is installed on your system:

$ pip --versionpip 7.0.3 from /usr/local/lib/python3.5/dist-packages (python 3.5)

The output of pip --version tells you which version of pip is currently installed, and which version of Python it’s set up to install packages for. This is especially helpful if you have more than one version of Python installed on your system.

If you have only one version of Python installed on your system, you can use pip to install packages. You might want to try upgrading pip first though.

If you have more than one version of Python installed on your system, you should also try the command pip3:

$ pip3 --versionpip 7.0.3 from /usr/local/lib/python3.5/dist-packages (python 3.5)

Here pip3 is set up to install to the same version of Python, but often times pip will install to Python 2. pip3, if you have it set up, should always install packages to the version of Python 3 you have installed.

top

Installing pip on Linux

To install pip, go to https://bootstrap.pypa.io/get-pip.py. Save the file if you’re prompted to do so; if the code for get-pip.py appears in your browser, copy and paste the entire program into your text editor and save the file as get-pip.py.

Open a terminal and navigate to the folder containing get-pip.py, and run it with administrative privileges:

$ cd DownloadsDownloads$ sudo python get-pip.pyCollecting pip Downloading pip-7.1.2-py2.py3-none-any.whl (1.1MB) 100% |████████████████████████████████| 1.1MB 448kB/s Collecting setuptools Downloading setuptools-18.4-py2.py3-none-any.whl (462kB) 100% |████████████████████████████████| 462kB 676kB/s Collecting wheel Downloading wheel-0.26.0-py2.py3-none-any.whl (63kB) 100% |████████████████████████████████| 65kB 912kB/s Installing collected packages: pip, setuptools, wheelSuccessfully installed pip-7.1.2 setuptools-18.4 wheel-0.26.0

After the program runs, use the command pip --version (or pip3 --version) to make sure pip was installed correctly.

top

Upgrading pip on Linux

Once you have pip installed, it’s good to upgrade it from time to time. Usually pip will prompt you with instructions for how to upgrade it when necessary, but you can try to upgrade manually any time. For example, here’s sample output for upgrading an out-of-date version of pip:

$ sudo pip install --upgrade pipYou are using pip version 6.1.1, however version 7.1.2 is available.You should consider upgrading via the 'pip install --upgrade pip' command.Collecting pip Downloading pip-7.1.2-py2.py3-none-any.whl (1.1MB) 100% |████████████████████████████████| 1.1MB 382kB/s Installing collected packages: pip Found existing installation: pip 6.1.1 Uninstalling pip-6.1.1: Successfully uninstalled pip-6.1.1Successfully installed pip-7.1.2

top

Installing Python packages with pip on Linux

Once you have pip installed, most Python packages can be installed in one line. For example, here’s how you can install Requests, which is used to make API calls from Python programs:

$ pip install --user requestsCollecting requests Downloading requests-2.8.1-py2.py3-none-any.whl (497kB) 100% |████████████████████████████████| 499kB 595kB/s Installing collected packages: requestsSuccessfully installed requests

Here pip has downloaded the files needed to install Requests, and then managed the installation for us. The --user flag means pip has made Requests available to us, but not to other users. This keeps each user’s Python packages from conflicting with each other on systems with more than one user. It’s a good idea to use this flag unless you have a specific reason not to.

Now you can start a Python terminal session, and import requests:

$ python>>> import requests>>> url = "http://google.com">>> r = requests.get(url)>>> r.status_code200

Here we’ve used requests to retrieve Google’s home page, and the status code of 200 tells us that the request was successful.

top

Uninstalling packages with pip on Linux

If you ever want to uninstall a package, you can use requests to do so as well:

$ pip uninstall requestsUninstalling requests-2.8.1: /home/ehmatthes/.local/lib/python3.5/site-packages/requests-2.8.1.dist-info/DESCRIPTION.rst ...Proceed (y/n)? y Successfully uninstalled requests-2.8.1

Pip lists all the files that will be removed, prompts you about whether to proceed, and then uninstalls the package.

top

Pip on OS X

Checking for pip on OS X

First, check whether pip is installed on your system:

$ pip --versionpip 7.0.3 from /usr/local/lib/python3.5/dist-packages (python 3.5)

The output of pip --version tells you which version of pip is currently installed, and which version of Python it’s set up to install packages for. This is especially helpful if you have more than one version of Python installed on your system.

If you have only one version of Python installed on your system, you can use pip to install packages. You might want to try upgrading pip first though.

If you have more than one version of Python installed on your system, you should also try the command pip3:

$ pip3 --versionpip 7.0.3 from /usr/local/lib/python3.5/dist-packages (python 3.5)

Here pip3 is set up to install to the same version of Python, but often times pip will install to Python 2. pip3, if you have it set up, should always install packages to the version of Python 3 you have installed.

top

Installing pip on OS X

To install pip, go to https://bootstrap.pypa.io/get-pip.py. Save the file if you’re prompted to do so; if the code for get-pip.py appears in your browser, copy and paste the entire program into your text editor and save the file as get-pip.py.

Open a terminal and navigate to the folder containing get-pip.py, and run it with administrative privileges:

$ cd DownloadsDownloads$ sudo python get-pip.pyCollecting pip Downloading pip-7.1.2-py2.py3-none-any.whl (1.1MB) 100% |████████████████████████████████| 1.1MB 448kB/s Collecting setuptools Downloading setuptools-18.4-py2.py3-none-any.whl (462kB) 100% |████████████████████████████████| 462kB 676kB/s Collecting wheel Downloading wheel-0.26.0-py2.py3-none-any.whl (63kB) 100% |████████████████████████████████| 65kB 912kB/s Installing collected packages: pip, setuptools, wheelSuccessfully installed pip-7.1.2 setuptools-18.4 wheel-0.26.0

After the program runs, use the command pip --version (or pip3 --version) to make sure pip was installed correctly.

top

Upgrading pip on OS X

Once you have pip installed, it’s good to upgrade it from time to time. Usually pip will prompt you with instructions for how to upgrade it when necessary, but you can try to upgrade manually any time. For example, here’s sample output for upgrading an out-of-date version of pip:

$ sudo pip install --upgrade pipYou are using pip version 6.1.1, however version 7.1.2 is available.You should consider upgrading via the 'pip install --upgrade pip' command.Collecting pip Downloading pip-7.1.2-py2.py3-none-any.whl (1.1MB) 100% |████████████████████████████████| 1.1MB 382kB/s Installing collected packages: pip Found existing installation: pip 6.1.1 Uninstalling pip-6.1.1: Successfully uninstalled pip-6.1.1Successfully installed pip-7.1.2

top

Installing Python packages with pip on OS X

Once you have pip installed, most Python packages can be installed in one line. For example, here’s how you can install Requests, which is used to make API calls from Python programs:

$ pip install --user requestsCollecting requests Downloading requests-2.8.1-py2.py3-none-any.whl (497kB) 100% |████████████████████████████████| 499kB 595kB/s Installing collected packages: requestsSuccessfully installed requests

Here pip has downloaded the files needed to install Requests, and then managed the installation for us. The --user flag means pip has made Requests available to us, but not to other users. This keeps each user’s Python packages from conflicting with each other on systems with more than one user. It’s a good idea to use this flag unless you have a specific reason not to.

Now you can start a Python terminal session, and import requests:

$ python>>> import requests>>> url = "http://google.com">>> r = requests.get(url)>>> r.status_code200

Here we’ve used requests to retrieve Google’s home page, and the status code of 200 tells us that the request was successful.

top

Uninstalling packages with pip on OS X

If you ever want to uninstall a package, you can use requests to do so as well:

$ pip uninstall requestsUninstalling requests-2.8.1: /home/ehmatthes/.local/lib/python3.5/site-packages/requests-2.8.1.dist-info/DESCRIPTION.rst ...Proceed (y/n)? y Successfully uninstalled requests-2.8.1

Pip lists all the files that will be removed, prompts you about whether to proceed, and then uninstalls the package.

top

Pip on Windows

Checking for pip on Windows

First, check whether pip is installed on your system. Open a terminal window and issue the following command:

> python -m pip --versionpip 7.0.3 from C:\Python35\lib\site-packages (python 3.5)

The output of pip --version tells you which version of pip is currently installed, and which version of Python it’s set up to install packages for. This is especially helpful if you have more than one version of Python installed on your system.

If you have only one version of Python installed on your system, you can use pip to install packages. You might want to try upgrading pip first though.

If you have more than one version of Python installed on your system, you should also try the command pip3:

> python -m pip3 --versionpip 7.0.3 from C:\Python35\lib\site-packages (python 3.5)

Here pip3 is set up to install to the same version of Python, but often times pip will install to Python 2. pip3, if you have it set up, should always install packages to the version of Python 3 you have installed.

top

Installing pip on Windows

To install pip, go to https://bootstrap.pypa.io/get-pip.py. Save the file if you’re prompted to do so; if the code for get-pip.py appears in your browser, copy and paste the entire program into your text editor and save the file as get-pip.py.

Open a terminal and navigate to the folder containing get-pip.py, and run it with administrative privileges:

> cd DownloadsDownloads> python get-pip.pyCollecting pip Downloading pip-7.1.2-py2.py3-none-any.whl (1.1MB) 100% |████████████████████████████████| 1.1MB 448kB/s Collecting setuptools Downloading setuptools-18.4-py2.py3-none-any.whl (462kB) 100% |████████████████████████████████| 462kB 676kB/s Collecting wheel Downloading wheel-0.26.0-py2.py3-none-any.whl (63kB) 100% |████████████████████████████████| 65kB 912kB/s Installing collected packages: pip, setuptools, wheelSuccessfully installed pip-7.1.2 setuptools-18.4 wheel-0.26.0

After the program runs, use the command pip --version (or pip3 --version) to make sure pip was installed correctly.

top

Upgrading pip on Windows

Once you have pip installed, it’s good to upgrade it from time to time. Usually pip will prompt you with instructions for how to upgrade it when necessary, but you can try to upgrade manually any time. For example, here’s sample output for upgrading an out-of-date version of pip:

> python -m pip install --upgrade pipYou are using pip version 6.1.1, however version 7.1.2 is available.You should consider upgrading via the 'pip install --upgrade pip' command.Collecting pip Downloading pip-7.1.2-py2.py3-none-any.whl (1.1MB) 100% |████████████████████████████████| 1.1MB 382kB/s Installing collected packages: pip Found existing installation: pip 6.1.1 Uninstalling pip-6.1.1: Successfully uninstalled pip-6.1.1Successfully installed pip-7.1.2

top

Installing Python packages with pip on Windows

Once you have pip installed, most Python packages can be installed in one line. For example, here’s how you can install Requests, which is used to make API calls from Python programs:

> python -m pip install --user requestsCollecting requests Downloading requests-2.8.1-py2.py3-none-any.whl (497kB) 100% |████████████████████████████████| 499kB 595kB/s Installing collected packages: requestsSuccessfully installed requests

Here pip has downloaded the files needed to install Requests, and then managed the installation for us. The --user flag means pip has made Requests available to us, but not to other users. This keeps each user’s Python packages from conflicting with each other on systems with more than one user. It’s a good idea to use this flag unless you have a specific reason not to.

Now you can start a Python terminal session, and import requests:

> python>>> import requests>>> url = "http://google.com">>> r = requests.get(url)>>> r.status_code200

Here we’ve used requests to retrieve Google’s home page, and the status code of 200 tells us that the request was successful.

top

Uninstalling packages with pip on Windows

If you ever want to uninstall a package, you can use requests to do so as well:

> python -m pip uninstall requestsUninstalling requests-2.8.1: ...Proceed (y/n)? y Successfully uninstalled requests-2.8.1

Pip lists all the files that will be removed, prompts you about whether to proceed, and then uninstalls the package.

top

Python Crash Course by ehmatthes (2024)

FAQs

Is Python Crash Course a good book for beginners? ›

The Python Crash Course is an excellent book that provides a thorough introduction to Python that will have you writing programs and solving problems in no time!" "Brilliant." "I recommend this book to anyone learning python. It is my best resource so far."

How long does Python Crash Course take? ›

Python Crash Course: A Hands-On, Project-Based Introduction to Programming. The average reader, reading at a speed of 300 WPM, would take 3 hours and 21 minutes to read Python Crash Course: A Hands-On, Project-Based Introduction to Programming by Eric Matthes.

Is the Python Crash Course free? ›

Experienced Python developers developed this free online Python crash course, and the course is divided into self-contained modules that progressively teach Python programming to all Python enthusiasts.

How do I pass the Python certification exam? ›

Take practice exams: Practice exams can help you identify your strengths and weaknesses and focus your study efforts. You can find practice exams online or in Python programming books. Join a study group: Joining a study group or working with a study partner can help you stay motivated and accountable.

Is 2 hours a day enough to learn Python? ›

To learn the very basics of Python, 2 hours per day for two weeks can be enough. Considering it takes 500+ hours to reach a somewhat advanced level, though, you'll have to study Python for 4 hours per day for 5 months to get there.

Is 1 week enough to learn Python? ›

A beginner will take about 6-8 weeks to learn the fundamentals of Python. It takes that much time to learn how to understand most lines of code in Python. It would take significantly more time learning Python to move into a new career as a Python Developer.

How fast can I learn Python and get a job? ›

How long does it take to learn Python? If you're looking for a general answer, here it is: Learning the Python basics may only take a few weeks. However, if you're pursuing a career as a programmer or data scientist, you can expect it to take four to twelve months to learn enough advanced Python to be job-ready.

What to do after completing a Python crash course? ›

You can go to a programming-specific conference, or a conference that's related to the field you'd like to start working in. Join a learning community, and keep track of the people you meet. Good networking takes time, so aim to build good professional relationships slowly and steadily.

Is it worth paying for a Python course? ›

Formal Python training is more than worthwhile for careers demanding Python proficiency: it's essential. Careers that require Python expertise range from Data Scientists and Data Analysts to Machine Learning (ML) Engineers, Python Developers, and Software Engineers.

Is Python certificate sufficient to get a job? ›

While a Python certification is a good step in the right direction, the certification doesn't prove you have the ability to do the work in the real world. This means that certificates aren't a very useful credential on their own, even if you get one from a highly selective bootcamp program.

What is the most difficult Python certification? ›

Certified Expert in Python Programming (CEPP)

Designed for professionals seeking to elevate their programming skills, the CEPP involves rigorous training and assessment, ensuring certified individuals are equipped to tackle complex programming challenges in various tech domains.

How should a beginner start learning Python? ›

The best way to learn Python is by using it. Working on real projects gives you the opportunity to apply the concepts you've learned and gain hands-on experience. Start with simple projects that reinforce the basics, and gradually take on more complex ones as your skills improve.

Is Python a good start for beginners? ›

Yes. Python is a great language for programming beginners because you don't need prior experience with code to pick it up. Dataquest helps students with no coding experience get jobs as data analysts, data scientists, and data engineers.

Top Articles
ARCHIVE - 1970s Bill Gibb Three Piece Orange Patterned Woollen Set
10 Best Vanguard ETFs To Invest In for 2024
123Movies Encanto
Craigslist Free En Dallas Tx
Froedtert Billing Phone Number
Chicago Neighborhoods: Lincoln Square & Ravenswood - Chicago Moms
Meer klaarheid bij toewijzing rechter
Mylaheychart Login
Is Csl Plasma Open On 4Th Of July
GAY (and stinky) DOGS [scat] by Entomb
Concacaf Wiki
OnTrigger Enter, Exit ...
Jc Post News
No Hard Feelings Showtimes Near Cinemark At Harlingen
Moviesda3.Com
Paradise leaked: An analysis of offshore data leaks
Craighead County Sheriff's Department
24 Hour Drive Thru Car Wash Near Me
Kylie And Stassie Kissing: A Deep Dive Into Their Friendship And Moments
Lcwc 911 Live Incident List Live Status
SF bay area cars & trucks "chevrolet 50" - craigslist
Kamzz Llc
Accident On The 210 Freeway Today
Allybearloves
Morristown Daily Record Obituary
Violent Night Showtimes Near Century 14 Vallejo
Employee Health Upmc
Directions To Cvs Pharmacy
Redfin Skagit County
55Th And Kedzie Elite Staffing
Dashboard Unt
UCLA Study Abroad | International Education Office
Truvy Back Office Login
Uno Fall 2023 Calendar
Plasma Donation Racine Wi
Average weekly earnings in Great Britain
Peter Vigilante Biography, Net Worth, Age, Height, Family, Girlfriend
Blue Beetle Movie Tickets and Showtimes Near Me | Regal
Ket2 Schedule
Oriellys Tooele
Metro Pcs Forest City Iowa
Henry Ford’s Greatest Achievements and Inventions - World History Edu
Seminary.churchofjesuschrist.org
Tattoo Shops In Ocean City Nj
Phone Store On 91St Brown Deer
Sapphire Pine Grove
O'reilly's On Marbach
Costco Gas Price Fort Lauderdale
ats: MODIFIED PETERBILT 389 [1.31.X] v update auf 1.48 Trucks Mod für American Truck Simulator
Latest Posts
Article information

Author: Cheryll Lueilwitz

Last Updated:

Views: 6093

Rating: 4.3 / 5 (54 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Cheryll Lueilwitz

Birthday: 1997-12-23

Address: 4653 O'Kon Hill, Lake Juanstad, AR 65469

Phone: +494124489301

Job: Marketing Representative

Hobby: Reading, Ice skating, Foraging, BASE jumping, Hiking, Skateboarding, Kayaking

Introduction: My name is Cheryll Lueilwitz, I am a sparkling, clean, super, lucky, joyous, outstanding, lucky person who loves writing and wants to share my knowledge and understanding with you.