Install pip for the Python interpreter you use
Check for pip, choose a supported installation method, and keep project packages separate from a system-managed Python.
First check whether pip is already available for the interpreter you want:
python -m pip --version
Use python3 on systems where that is the appropriate command, or py -m pip --version with the Windows Python launcher. A bare pip --version can refer to a different Python installation.
The usual python.org installers provide pip, but embedded packages, minimal images, and operating-system distributions can differ. Choose the installation method that belongs to your Python distribution.
Bootstrap with ensurepip
For a self-managed Python that includes the module:
python -m ensurepip --upgrade
ensurepip uses bundled components and does not need network access. It installs or upgrades to that bundled pip version, which need not be the newest available release.
Use the operating-system packages
For distribution-managed Python, use the distributor's packages. Examples include:
# Debian or Ubuntu.
sudo apt install python3-pip python3-venv
# A compatible Fedora/RHEL-family distribution.
sudo dnf install python3-pip
# Arch Linux.
sudo pacman -S python-pip
Package names and repositories vary by distribution release. Older systems may use yum; follow the documentation for the installed release instead of assuming every command applies everywhere.
On Windows, the standard Python installer can add pip through its installation or Modify options. Python distributions and newer install-management tools have their own workflows; verify the selected interpreter afterward.
Use get-pip.py only where appropriate
For a Python installation you manage independently, the pip project also documents a bootstrap script:
curl --fail --show-error --location https://bootstrap.pypa.io/get-pip.py -o get-pip.py
# Inspect the downloaded script and confirm the intended interpreter.
python get-pip.py
Do not run it with elevated privileges to bypass an externally managed environment or overwrite distribution-owned pip files. Keep TLS verification enabled and use a bootstrap version compatible with the interpreter.
Work in a virtual environment
python -m venv .venv
# POSIX shell:
source .venv/bin/activate
python -m pip install --upgrade pip
On Windows, activate with .venv\Scripts\Activate.ps1 in PowerShell or .venv\Scripts\activate.bat in Command Prompt. Activation is optional: invoking the environment's Python executable directly also selects it.
Troubleshoot the selected installation
If python -m pip works but pip does not, its scripts directory may be absent from PATH. You can continue using the interpreter-qualified form.
If ensurepip is missing, consult the distributor. On Debian/Ubuntu, the matching python3-venv or version-specific venv package is often needed to create environments, while python3-pip supplies the packaged pip.
For permission or externally-managed errors, create a virtual environment instead of using sudo pip install. --user is not a general workaround for an externally managed installation.
References: pip installation, ensurepip, and externally managed environments.
Related reading
Contact us
Join the community
to join the community
Try Guance
Start online and pay only for what you use.
Get startedChoose a Guance plan