pip cheat sheet - useful pip commands
This cheat sheet provides a collection of the most commonly used pip commands in each category to help you manage your Python packages and projects effectively.
Table of contents
Package installation and management
pip install <package_name>
or pip -i <package_name>
Installs the specified package.
pip install <package_name>
pip install <package_name>==<version>
or pip -i <package_name>==<version>
Installs a specific version of the package.
pip install <package_name>==<version>
pip install -r requirements.txt
Installs packages from a requirements.txt file.
pip install -r requirements.txt
pip install --upgrade <package_name>
or pip install -U <package_name>
Upgrades the specified package.
pip install --upgrade <package_name>
pip install --upgrade <package_name>==<version>
or pip install -U <package_name> -v
Upgrades to a specific version of the package.
pip install --upgrade <package_name>==<version>
pip install --upgrade -r requirements.txt
or pip install --U -r requirements.txt
Upgrades packages according to the requirements.txt file.
pip install --upgrade -r requirements.txt
pip uninstall <package_name>
Uninstalls the specified package.
pip uninstall <package_name>
Package information
pip show <package_name>
Displays information about the specified package.
pip show <package_name>
pip list
Lists all installed packages.
pip list
pip list --outdated
or pip list -o
Shows outdated packages.
pip list --outdated
Package search
pip search <search_term>
Searches for packages containing the specified search term.
pip search <search_term>
Virtual environments
pipenv install
or pipenv i
Creates a virtual environment and installs packages from the Pipfile.
pipenv install
pipenv install <package_name>
or pipenv i <package_name>
Installs a package in the virtual environment.
pipenv install <package_name>
pipenv uninstall <package_name>
or pipenv un <package_name>
Uninstalls a package from the virtual environment.
pipenv uninstall <package_name>
pipenv shell
or pipenv sh
Activates the virtual environment.
pipenv shell
pipenv lock
or pipenv lck
Generates a Pipfile.lock file with exact package versions.
pipenv lock
Package updates and security
pip list --outdated
or pip list -o
Lists outdated packages.
pip list --outdated
pip check
or pip verify
Checks for security vulnerabilities in installed packages.
pip check
pip install --upgrade pip
or pip install -U pip
Upgrades the pip installation itself.
pip install --upgrade pip
Package files and sources
pip download <package_name>
or pip dl <package_name>
Downloads the package without installing it.
pip download <package_name>
pip wheel <package_directory>
or pip whl <package_directory>
Creates a wheel package for distribution.
pip wheel <package_directory>
pip install <file_path>
Installs a package from a local file.
pip install <file_path>
pip install <URL>
Installs a package from a URL.
pip install <URL>
Package dependencies
pip check
or pip verify
Checks for missing or incompatible dependencies.
pip check
pipdeptree
Shows the dependency tree of installed packages.
pipdeptree
pip install --no-deps <package_name>
Installs the package without its dependencies.
pip install --no-deps <package_name>
Package dependencies
pip freeze
or pip freeze > requirements.txt
Generates a requirements.txt file with the installed packages.
pip freeze
pipenv
or pipenv --help
Provides more comprehensive package management and virtual environments.
pipenv
Proxy and cache configuration
pip config
Configures proxy and cache settings for pip.
pip freeze