LinuxCommandLibrary

pip

TLDR

Install a package

$ pip install [package]
copy
Install a specific version
$ pip install [package]==[1.0.0]
copy
Install packages from requirements file
$ pip install -r [requirements.txt]
copy
Upgrade a package
$ pip install --upgrade [package]
copy
Uninstall a package
$ pip uninstall [package]
copy
List installed packages
$ pip list
copy
Show package information
$ pip show [package]
copy
Generate requirements file
$ pip freeze > [requirements.txt]
copy
Install for current user only
$ pip install --user [package]
copy

SYNOPSIS

pip command [options] [package...]
pip install [options] package
python -m pip command [options]

DESCRIPTION

pip is the package installer for Python, used to install and manage packages from the Python Package Index (PyPI) and other repositories. It handles dependency resolution, downloading, and installation of Python packages.
Packages can be installed globally (requires root), per-user with --user, or in virtual environments (recommended). Version specifiers allow precise control: == for exact, >= for minimum, ~= for compatible versions.
The requirements.txt format, generated by pip freeze, records exact versions for reproducible installations. Modern Python recommends using python -m pip instead of the bare pip command to ensure the correct Python interpreter is used.

PARAMETERS

-U, --upgrade

Upgrade packages to newest version
--user
Install to user directory (~/.local)
-r, --requirement FILE
Install from requirements file
--no-deps
Don't install dependencies
--force-reinstall
Reinstall even if up-to-date
-I, --ignore-installed
Ignore installed packages
--pre
Include pre-release versions
-i, --index-url URL
Base URL of package index
--extra-index-url URL
Additional package index URL
-e, --editable PATH
Install in editable/development mode
--target DIR
Install to specified directory
-y, --yes
Don't ask for confirmation
-q, --quiet
Minimal output
-v, --verbose
Verbose output
-V, --version
Show version
-h, --help
Show help

COMMANDS

install

Install packages
uninstall
Remove packages
list
List installed packages
show
Show package information
freeze
Output installed packages in requirements format
search
Search PyPI for packages (deprecated)
download
Download packages without installing
wheel
Build wheel packages
check
Verify installed packages have compatible dependencies
config
Manage configuration
cache
Manage pip's cache

CAVEATS

On Linux systems, avoid using pip with sudo to install packages globally as it can conflict with system packages. Use virtual environments or --user instead. Some distributions rename pip to pip3 for Python 3. The search command was disabled on PyPI due to abuse. Package installation may require compilation and build dependencies.

HISTORY

pip was created by Ian Bicking and first released in 2008 as a replacement for easy_install. The name is a recursive acronym: "pip installs packages". It became the standard Python package manager, included by default with Python since version 3.4. The Python Packaging Authority (PyPA) now maintains pip, continuously improving dependency resolution, security, and performance.

SEE ALSO

python(1), virtualenv(1), pipenv(1), conda(1)

Copied to clipboard