Short answer: pip usually comes with Python. Check with python3 -m pip --version (py -m pip --version on Windows). If it is missing, run sudo apt install python3-pip python3-venv on Debian and Ubuntu, or py -m ensurepip --upgrade with a python.org Python on Windows. Then install packages with python3 -m pip install NAME, inside a virtual environment.
python3 -m pip --version # Linux · macOS
py -m pip --version # Windowspip 23.0.1 from /usr/lib/python3/dist-packages/pip (python 3.11)That line tells you three things: pip is installed, which version it is, and which Python it belongs to (the part in brackets). The two other answers you can get:
/usr/bin/python3: No module named pip: Python is there, pip is not. Install it for your system below.python3: command not foundor Windows’Python was not found: Python itself is missing, so start with python: command not found.
If the bare pip command is what fails while python3 -m pip works, the error page pip: command not found has that case. This guide is about getting pip onto a system and using pip install well.
How do I install pip on Windows?
The installers from python.org include pip, so on Windows “installing pip” mostly means installing Python with the right boxes ticked, then calling pip through the py launcher.
- 1Run the python.org installer
On the first screen, tick Add python.exe to PATH (it is off by default). Under Customize installation, the pip feature is ticked by default; leave it on. Since Python 3.14, python.org also offers the Python install manager for Windows, which installs runtimes with
py install; pip comes with those runtimes too, as it does with Python from the Microsoft Store. - 2Open a new terminal and check
PowerShell or cmd py --version py -m pip --versionA terminal that was open during the install keeps its old PATH, so open a fresh one.
- 3If pip is missing, bootstrap it
PowerShell or cmd py -m ensurepip --upgrade py -m pip --versionensurepipis part of the Python standard library and installs the pip copy that ships inside Python, with no download. - 4Install packages with py -m pip
PowerShell or cmd py -m pip install requests
'pip' is not recognized as an internal or external command means pip is installed but its folder is not on the PATH. pip.exe lives in the Scripts folder of the Python install, for a per-user install %LOCALAPPDATA%\Programs\Python\Python3XX\Scripts. Either keep using py -m pip, which needs no PATH entry, or run the installer again, choose Modify, and tick Add Python to environment variables under Advanced Options. The same steps work on Windows Server 2022 and 2019, where curl.exe is also available for the get-pip.py route.
How do I install pip on Linux?
| Distribution | Command |
|---|---|
| Debian, Ubuntu | sudo apt install python3-pip python3-venv |
| Rocky Linux, AlmaLinux, Fedora, RHEL | sudo dnf install python3-pip |
| Alpine | apk add py3-pip |
| Arch Linux | sudo pacman -S python-pip |
| openSUSE | sudo zypper install python3-pip |
Use the package manager on Linux, not get-pip.py: the system Python belongs to the distribution, and its tools depend on it. Debian 12’s python3-pip is pip 23.0.1 and installs three names for the same program, /usr/bin/pip, pip3 and pip3.11. It also recommends build-essential and python3-dev, so apt pulls in a full compiler toolchain by default. That helps when a package has to be compiled; on a small server that only installs ready-built wheels, add --no-install-recommends.
Then: error: externally-managed-environment
On Debian 12 and later and Ubuntu 23.04 and later, the next step usually fails. Here is a plain pip install outside a virtual environment on Debian 12:
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
...
hint: See PEP 668 for the detailed specification.pip install --user is refused the same way. That is intended (PEP 668): pip stays out of the Python that apt manages. Install into a virtual environment instead, or use pipx for command-line tools:
python3 -m venv ~/venvs/app
. ~/venvs/app/bin/activate
python -m pip install requests # goes into ~/venvs/app, nothing system-wide changes
sudo apt install -y pipx # for tools you run as commands
pipx install httpieEvery option, including why --break-system-packages is the last resort, is in the externally-managed-environment section of the pip error guide.
How do I install pip on macOS?
The python.org installer for macOS includes pip; call it as pip3 or python3 -m pip. Homebrew’s Python (brew install python) includes pip3 as well, but is marked externally managed like Debian’s, so use a venv there. The python3 that comes with Apple’s Command Line Tools also has pip3. None of them installs a bare pip; the macOS section of the error guide shows how to add one.
ensurepip or get-pip.py: which one?
pip’s own installation guide (pip.pypa.io) lists two supported methods for a Python that has no pip:
python -m ensurepip --upgradeinstalls the pip copy bundled with Python itself, offline. Debian and Ubuntu move ensurepip into thepython3.X-venvpackage and do not let you use it on the system Python, so there it only servesvenv.- get-pip.py downloads the newest pip. Take it only from
https://bootstrap.pypa.io/get-pip.py, the address pip’s documentation gives, and only for a Python you built or installed yourself (python.org, a source build, the Windows embeddable package), never for a distribution’s system Python.
# Linux · macOS
curl -fsSLO https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py
# Windows
curl.exe -o get-pip.py https://bootstrap.pypa.io/get-pip.py
py get-pip.pyFor an old Python that current pip no longer supports, the same site keeps versioned copies under https://bootstrap.pypa.io/pip/3.X/get-pip.py. The Windows embeddable package ships without pip and without site enabled: uncomment import site in its python3XX._pth file first, or installed packages will not be found.
How do I use pip install?
| Task | Command |
|---|---|
| Install a package | python3 -m pip install requests |
| An exact version | python3 -m pip install requests==2.32.3 |
| A version range (quote it) | python3 -m pip install "requests>=2.31,<3" |
| Upgrade a package | python3 -m pip install --upgrade requests |
| Everything in a requirements file | python3 -m pip install -r requirements.txt |
| The project in this folder, editable | python3 -m pip install -e . |
| A wheel file | python3 -m pip install ./pkg-1.0-py3-none-any.whl |
| From a Git repository | python3 -m pip install "git+https://github.com/OWNER/REPO.git@v1.2.0" |
| Show what is installed | python3 -m pip list |
| Details of one package | python3 -m pip show requests |
| Check for broken dependencies | python3 -m pip check |
| Remove a package | python3 -m pip uninstall requests |
Inside an active venv, pip and python already point into it, so plain pip install requests is fine there. Quote anything with > or < in it. Unquoted, the shell reads them as redirection: pip install requests>=2.31 installs the newest requests and writes pip’s output into a file called =2.31, and pip install requests<3 fails because there is no file named 3 to read from.
A full round trip with a small local package in a venv looks like this:
$ python -m pip install ./hello
...
Successfully built hello
Installing collected packages: hello
Successfully installed hello-0.1.0
$ python -m pip uninstall -y hello
Found existing installation: hello 0.1.0
Uninstalling hello-0.1.0:
Successfully uninstalled hello-0.1.0pip, pip3 or python -m pip?
pip3 is the name that makes clear you mean Python 3, from the years when pip could still mean Python 2. On Debian 12 all three names run the same program, and inside a venv pip, pip3 and pip3.X all belong to that venv. The safe habit is python3 -m pip (or py -m pip on Windows): it always uses the pip of the exact Python you name, so packages never land in a different interpreter than the one that runs your code. When in doubt, pip --version names that interpreter in brackets.
How do I upgrade pip?
python -m pip install --upgrade pip # Linux · macOS
py -m pip install --upgrade pip # Windows- On Windows, use the
-mform.pip install --upgrade pipstops withERROR: To modify pip, please run the following command:followed by thepython.exe -m pipversion, because Windows cannot replace thepip.exethat is running. - On Debian and Ubuntu, leave the system pip to apt.
sudo apt install --only-upgrade python3-pipbrings what the release supports. Upgrading it with pip itself is refused as externally managed, and forcing it leaves two pips that apt and pip both think they own. A venv gets its own pip, which you can upgrade freely. - “
[notice] A new release of pip is available” after an install is information, not an error. In a venv, run the command it suggests; on the system Python, ignore it.
pip install pip on a working pip only answers Requirement already satisfied; it needs --upgrade to do anything. And pip cannot install itself where it is missing: that is the job of apt, ensurepip or get-pip.py.
requirements.txt: install a project’s dependencies
# one requirement per line
requests==2.32.3
flask>=3.0,<4
gunicornpython3 -m venv .venv && . .venv/bin/activate
python -m pip install -r requirements.txt
python -m pip freeze > requirements.txt # write the exact versions backpip freeze lists every package in the current environment with its exact version, so run it from the project’s venv: outside one it dumps the whole system Python. A package installed from a local folder or Git appears as name @ file:///… or name @ git+https://… rather than with a version number. python -m pip uninstall -r requirements.txt -y removes the listed packages again; uninstall never removes their dependencies, so for a clean slate delete the venv and create it anew.
How do I uninstall pip?
- Debian and Ubuntu:
sudo apt remove python3-pip. - A venv: delete the venv folder; its pip goes with it.
- Windows or a python.org Python:
py -m pip uninstall pip(python3 -m pip uninstall pipon macOS).ensurepipbrings it back.
Common pip install errors
| Message | Cause | Fix |
|---|---|---|
error: externally-managed-environment | pip outside a venv on Debian 12+, Ubuntu 23.04+ | venv or pipx |
'pip' is not recognized as an internal or external command | Windows: the Scripts folder is not on the PATH | py -m pip, or add Python to the PATH |
No module named pip | This Python has no pip | apt, dnf, apk or ensurepip |
Could not find a version that satisfies the requirement | Typo in the name, no build for your Python version or platform, or no network | Check the name on PyPI and python3 --version |
The script … is installed in '…' which is not on PATH | Commands went to ~/.local/bin or a Scripts folder | Add that folder to the PATH |
Microsoft Visual C++ 14.0 or greater is required | Windows: no wheel, so the package needs compiling | Install Microsoft C++ Build Tools, or a version that ships a wheel |
Killed | The build ran out of memory | Add swap or RAM |
“Could not find a version” looks like this (here from a package name that does not exist, on Debian 12 with pip 23.0.1):
ERROR: Could not find a version that satisfies the requirement vmh-no-such-package-xyz (from versions: none)
ERROR: No matching distribution found for vmh-no-such-package-xyz(from versions: none) means pip found nothing usable at all: a wrong name, an index it cannot reach, or a package with no release for your Python version. A list of versions in the brackets means the package exists, but none of those fits your version pin or your Python. If you work with conda, install with conda first and pip only for what conda lacks, inside the same environment; a missing conda command is its own fix: conda: command not found.
Frequently asked
How do I install pip on Windows?
Install Python from python.org with the pip feature ticked (it is by default) and Add python.exe to PATH ticked, then open a new terminal and run py -m pip --version. If pip is missing, py -m ensurepip --upgrade installs the copy bundled with Python. If 'pip' is not recognized as a command, use py -m pip, which needs no PATH entry.
How do I install pip on Ubuntu or Debian?
Run sudo apt install python3-pip python3-venv. Then install packages inside a virtual environment (python3 -m venv .venv, then .venv/bin/pip install NAME), because Debian 12 and later and Ubuntu 23.04 and later refuse pip install into the system Python with error: externally-managed-environment.
How do I update pip?
Inside a virtual environment, or with a python.org Python, run python -m pip install --upgrade pip (py -m pip install --upgrade pip on Windows, where plain pip install --upgrade pip stops with 'To modify pip, please run the following command'). On Debian and Ubuntu, leave the system pip to apt.
What is the difference between pip and pip3?
pip3 names the pip for Python 3, from the years when pip could still mean Python 2. On current systems both usually run the same program, and inside a virtual environment they always do. python3 -m pip (py -m pip on Windows) is the safe form, because it uses the pip of exactly that interpreter.