pip Cheat Sheet

Core pip commands for installing, upgrading, uninstalling, inspecting, and managing Python packages.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all
## Basics
Show pip version
python -m pip --version

# Print the installed pip version and Python path.

Show top-level help
python -m pip help

# Display general pip help and available commands.

Show help for install
python -m pip help install

# Display options for the install command.

List installed packages
python -m pip list

# Show installed packages in the active environment.

List outdated packages
python -m pip list --outdated

# Show packages with newer available versions.

Show package details
python -m pip show requests

# Inspect metadata for an installed package.

## Install and Upgrade
Install a package
python -m pip install requests

# Install the latest version of a package.

Install a specific version
python -m pip install "requests==2.32.3"

# Pin installation to an exact version.

Install with a version range
python -m pip install "requests>=2.31,<3"

# Allow a controlled range of versions.

Upgrade a package
python -m pip install --upgrade requests

# Upgrade one package to the latest matching version.

Upgrade pip itself
python -m pip install --upgrade pip

# Update pip in the active interpreter.

Uninstall a package
python -m pip uninstall requests

# Remove an installed package.

Uninstall without prompt
python -m pip uninstall -y requests

# Remove a package non-interactively.

## Inspect and Verify
Check dependency health
python -m pip check

# Report broken or incompatible installed dependencies.

Freeze installed packages
python -m pip freeze

# Output pinned installed versions.

Inspect environment as JSON
python -m pip inspect

# Output structured JSON details for the environment.

List available versions
python -m pip index versions requests

# Show candidate versions for a package from the index.

Download without installing
python -m pip download requests -d ./packages

# Fetch distributions locally without modifying the environment.

## Indexes and Private Repositories
Install from a custom index
python -m pip install --index-url https://pypi.org/simple requests

# Use a specific package index URL.

Use an extra index
python -m pip install --extra-index-url https://example.com/simple internal-package

# Search an additional package index.

Mark host as trusted
python -m pip install --trusted-host internal.example.com --index-url http://internal.example.com/simple internal-package

# Bypass HTTPS verification restrictions for a host.

Allow pre-release versions
python -m pip install --pre package-name

# Permit alpha, beta, and release candidate versions.

## Builds and Wheels
Force source install
python -m pip install --no-binary :all: lxml

# Install from source instead of wheels.

Require binary wheels
python -m pip install --only-binary :all: numpy

# Only install wheel distributions.

Build wheel artifacts
python -m pip wheel -r requirements.txt -w ./wheelhouse

# Build wheels into a directory without installing.

Install from a wheel file
python -m pip install ./wheelhouse/package_name-1.0.0-py3-none-any.whl

# Install a local wheel artifact.

Recommended next

No recommendations yet.