Skip to content

pip

pip is the standard and default package manager for Python. It allows you to download, install, and manage Python libraries and dependencies from the Python Package Index (PyPI) and other repositories.

Installation and Setup

pip is included by default with CPython distributions since version 3.4. To ensure you have the latest versions of pip, you can run:

Language: Shell
$ python -m pip install --upgrade pip

If pip is not available in your Python installation, then you can run the following:

Language: Shell
$ python -m ensurepip --upgrade

Key Features

  • Installs Python packages and their required dependencies from PyPI or other package indices.
  • Supports installing packages from various sources, including Git repositories, ZIP files, wheel files, and local directories.
  • Enables users to specify exact package versions or define version ranges.
  • Facilitates environment replication by installing dependencies listed in a requirements.txt file.
  • Provides commands to list installed packages (pip list), view package metadata (pip show), and upgrade or uninstall existing packages.

Usage

Install the latest version of a package:

Language: Shell
$ python -m pip install package-name

Install specific versions of a package:

Language: Shell
$ # Exact version: ==
$ python -m pip install "package-name==version"

$ # At least version: >=
$ python -m pip install "package-name>=version"

$ # Less than version: <
$ python -m pip install "package-name<version"

Capture the environment:

Language: Shell
$ python -m pip freeze > requirements.txt

Replicate the environment:

Language: Shell
$ python -m pip install -r requirements.txt
Python Virtual Environments (venv)

Course

Working With Python Virtual Environments

This course demonstrates how Python's virtual environments work as a "sandbox" and you get a quick walkthrough on how to set up a new environment (or virtualenv, as they're called for short) and how to install third-party packages into it using the pip command.

basics tools

For additional information on related topics, take a look at the following resources:

Have a question about this? Mentor AI can show you examples, compare related terms, and point you to tutorials.


By Leodanis Pozo Ramos • Updated Sept. 30, 2026 • Reviewed by Dan Bader