pip is the standard tool for installing Python packages from the Python Package Index (PyPI) and other sources. It is included with Python 3.4+ and is typically invoked as python -m pip install package_name (or simply pip install package_name if the shell alias is available). pip resolves dependencies, downloads wheels or source distributions, and installs them into the current environment.
Common pip commands include pip install package (install), pip install --upgrade package (upgrade), pip uninstall package (remove), pip list (show installed packages), pip freeze (output installed packages in requirements.txt format), and pip install -r requirements.txt (install from a requirements file). pip can also install from local directories, Git repositories, and specific URLs.
pip should almost always be used inside a virtual environment to avoid polluting the system Python installation. Modern alternatives and complements to pip include pipx (for installing CLI tools in isolated environments), pip-tools (for deterministic dependency locking), and uv (a high-performance drop-in replacement written in Rust). Despite these alternatives, pip remains the foundation of Python package management and the tool most tutorials and documentation reference.
Related terms: Virtual Environment, PyPI, pyproject.toml
Discussed in:
- Chapter 2: Setting Up Python — Installing Packages with pip