Skip to content

Python, installing 3rd party packages using `pip`

FULL-STACK WEB DEVELOPMENT BOOTCAMP

2024 COHORT SIGNUPS END TOMORROW

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>
β†’ Get my Python Handbook
β†’ Get my Python Handbook
  • Learn modern web development in my BOOTCAMP (SIGNUP END TOMORROW FEB 20, 2024)
  • THE VALLEY OF CODE (+ PRO), your web development manual
  • I wrote 15+ coding BOOKS, all available in THE VALLEY OF CODE PRO
  • Indie solopreneur internet business masterclass SOLO LAB (summer 2024)