Skip to content

Python, installing 3rd party packages using `pip`

The Python standard library contains a huge number of utilities that simplify our Python development needs, but nothing can satisfy everything.

That’s why individuals and companies create packages, and make them available as open source software for the entire community.

Those modules are all collected in a single place, the Python Package Index available at https://pypi.org, and they can be installed on your system using pip.

There are more than 270.000 packages freely available, at the time of writing.

You should have pip already installed if you followed the Python installation instructions.

Install any package using the command pip install:

pip install <package>

or, if you do have troubles, you can also run it through python -m:

python -m pip install <package>

For example you can install the requests package, a popular HTTP library:

pip install requests

and once you do, it will be available for all your Python scripts, because packages are installed globally.

The exact location depends on your operating system.

On macOS, running Python 3.9, the location is /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages.

Upgrade a package to its latest version using:

pip install –U <package>

Install a specific version of a package using:

pip install <package>==<version>

Uninstall a package using:

pip uninstall <package>

Show an installed package details, including version, documentation website and author information using:

pip show <package>

→ Here's my latest YouTube video

→ Get my Python Handbook
→ Get my Python Handbook

→ I wrote 17 books to help you become a better developer, download them all at $0 cost by joining my newsletter

JOIN MY CODING BOOTCAMP, an amazing cohort course that will be a huge step up in your coding career - covering React, Next.js - next edition February 2025

Bootcamp 2025

Join the waiting list