pip

Linux · Packages · reference only

What it does

Python package installer: it installs, upgrades and uninstalls libraries from the PyPI repository.

Syntax

pip orden [opciones]

Options and parameters

  • install paquete

    Installs a package and its dependencies.

  • uninstall paquete

    Uninstalls a package.

  • list

    Lists the installed packages.

  • freeze

    Lists installed packages with their exact version, in requirements.txt format.

  • show paquete

    Shows the details of an installed package.

  • -r fichero

    With install, installs the packages from a requirements file.

  • --upgrade

    With install, upgrades the package if it is already installed.

  • --user

    Installs only for your user, without touching the system.

Usage examples

  • pip install requests

    Installs the requests library.

  • pip install -r requirements.txt

    Installs all of a project's dependencies.

  • pip list

    Shows the installed packages.

  • pip freeze > requirements.txt

    Saves the exact versions so the environment can be reproduced.

Notes and common mistakes

  • On Debian 12 you must install it with sudo apt install python3-pip.
  • Debian 12 protects the system Python (PEP 668): outside a virtual environment, pip install gives the externally-managed-environment error; use python3 -m venv or pipx.

Related commands