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

Print the installed pip version and Python path.

bashANYversioninspectbasics
bash
python -m pip --version
Notes

Useful when multiple Python interpreters exist and you need to confirm which pip instance is active.

Show top-level help

Display general pip help and available commands.

bashANYhelpbasics
bash
python -m pip help
Notes

Lists pip subcommands and global options.

Show help for install

Display options for the install command.

bashANYhelpinstall
bash
python -m pip help install
Notes

Great for discovering flags like `--upgrade`, `--requirement`, and `--index-url`.

List installed packages

Show installed packages in the active environment.

bashANYlistinspectpackages
bash
python -m pip list
Notes

Lists package names and installed versions.

List outdated packages

Show packages with newer available versions.

bashANYlistoutdatedupgrade
bash
python -m pip list --outdated
Notes

Useful before upgrading an environment or reviewing stale dependencies.

Show package details

Inspect metadata for an installed package.

bashANYinspectmetadatashow
bash
python -m pip show requests
Notes

Displays version, location, dependencies, and package metadata.

Install and Upgrade

Install a package

Install the latest version of a package.

bashANYinstallpackages
bash
python -m pip install requests
Notes

Installs the package into the active interpreter environment.

Install a specific version

Pin installation to an exact version.

bashANYinstallpinningversions
bash
python -m pip install "requests==2.32.3"
Notes

Use exact pins for reproducibility and compatibility control.

Install with a version range

Allow a controlled range of versions.

bashANYinstallversionsconstraints
bash
python -m pip install "requests>=2.31,<3"
Notes

Common in development workflows where some flexibility is acceptable.

Upgrade a package

Upgrade one package to the latest matching version.

bashANYupgradeinstall
bash
python -m pip install --upgrade requests
Notes

`--upgrade` tells pip to replace an installed version when a newer one is available.

Upgrade pip itself

Update pip in the active interpreter.

bashANYupgradepip
bash
python -m pip install --upgrade pip
Notes

Prefer `python -m pip` to avoid accidentally upgrading a different interpreter's pip.

Uninstall a package

Remove an installed package.

bashANYuninstallremove
bash
python -m pip uninstall requests
Notes

pip prompts for confirmation unless you pass `-y`.

Uninstall without prompt

Remove a package non-interactively.

bashANYuninstallautomation
bash
python -m pip uninstall -y requests
Notes

Useful in scripts and CI jobs.

Inspect and Verify

Check dependency health

Report broken or incompatible installed dependencies.

bashANYcheckdependencieshealth
bash
python -m pip check
Notes

Helpful after upgrading packages or mixing manual installs.

Freeze installed packages

Output pinned installed versions.

bashANYfreezerequirementslock
bash
python -m pip freeze
Notes

Typically used to generate `requirements.txt` style output.

Inspect environment as JSON

Output structured JSON details for the environment.

bashANYinspectjsonenvironment
bash
python -m pip inspect
Notes

Useful for tooling and automated analysis.

List available versions

Show candidate versions for a package from the index.

bashANYindexversionsinspect
bash
python -m pip index versions requests
Notes

Useful when choosing a version pin or troubleshooting resolver issues.

Download without installing

Fetch distributions locally without modifying the environment.

bashANYdownloadofflineartifacts
bash
python -m pip download requests -d ./packages
Notes

Good for offline installs, caching, or artifact prep.

Indexes and Private Repositories

Install from a custom index

Use a specific package index URL.

bashANYindexpypiinstall
bash
python -m pip install --index-url https://pypi.org/simple requests
Notes

Override the default package index for this invocation.

Use an extra index

Search an additional package index.

bashANYindexprivateinstall
bash
python -m pip install --extra-index-url https://example.com/simple internal-package
Notes

Common when mixing public PyPI packages with private packages.

Mark host as trusted

Bypass HTTPS verification restrictions for a host.

bashANYtrusted-hostprivatesecurity
bash
python -m pip install --trusted-host internal.example.com --index-url http://internal.example.com/simple internal-package
Notes

Use carefully. Prefer proper TLS whenever possible.

Allow pre-release versions

Permit alpha, beta, and release candidate versions.

bashANYpre-releaseversions
bash
python -m pip install --pre package-name
Notes

Useful when testing against preview package releases.

Builds and Wheels

Force source install

Install from source instead of wheels.

bashANYsourcebuildbinary
bash
python -m pip install --no-binary :all: lxml
Notes

Useful when you need local compilation or want to validate source builds.

Require binary wheels

Only install wheel distributions.

bashANYwheelsbinaryinstall
bash
python -m pip install --only-binary :all: numpy
Notes

Useful in environments where build toolchains are unavailable.

Build wheel artifacts

Build wheels into a directory without installing.

bashANYwheelbuildartifacts
bash
python -m pip wheel -r requirements.txt -w ./wheelhouse
Notes

Creates reusable wheel artifacts for later installation.

Install from a wheel file

Install a local wheel artifact.

bashANYwheelinstalllocal-file
bash
python -m pip install ./wheelhouse/package_name-1.0.0-py3-none-any.whl
Notes

Useful in offline or reproducible deployment workflows.

Recommended next

No recommendations yet.