Next-Gen App & Browser Testing Cloud

Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

Next-Gen App & Browser Testing Cloud

How to Install pip

Updated November 30, 2026 · Written and reviewed under our editorial policy

Most Python installs already include pip. To install or repair it, run python3 -m ensurepip --upgrade on a Mac (or a Python you installed yourself on Linux), or py -m ensurepip --upgrade on Windows. On the system Python of Debian or Ubuntu, install it with sudo apt install python3-pip instead. Check it worked with python3 -m pip --version. If ensurepip isn't available, download get-pip.py from bootstrap.pypa.io and run it with Python.

  • Check Python is installed: python3 --version (Windows: py --version).
  • Check for pip: python3 -m pip --version (Windows: py -m pip --version).
  • If missing, run python3 -m ensurepip --upgrade (Windows: py -m ensurepip --upgrade).
  • If that fails, download https://bootstrap.pypa.io/get-pip.py and run python3 get-pip.py (Windows: py get-pip.py).
  • Upgrade pip: python3 -m pip install --upgrade pip (Windows: py -m pip install --upgrade pip).

Source: pip documentation, "Installation" (pip.pypa.io), checked 2026-11-28.

Check whether pip is installed

To check whether pip is installed, ask Python for it instead of typing pip on its own. pip belongs to one Python install, so find out which Python version you have first. Then run:

# Mac and Linux
python3 -m pip --version

# Windows
py -m pip --version

A line starting with pip and a version number means pip is installed; the end of the line names the Python it belongs to. "No module named pip" means this Python has no pip yet, so follow the steps for your system below. No Python at all? The python.org installers include pip, so installing Python usually gets you pip as well (on a Mac, install Python on Mac with the python.org installer or Homebrew).

Install pip on Windows

On Windows, Python includes pip by default: the Python install manager adds it with each runtime, and in the traditional python.org installer it's the pip box under Optional Features when you choose Customize installation. If pip is missing or broken, install it with ensurepip in Command Prompt or PowerShell:

py -m ensurepip --upgrade
py -m pip --version

If ensurepip isn't available, download get-pip.py from https://bootstrap.pypa.io/get-pip.py, open a terminal in the folder where you saved it and run py get-pip.py.

Installing pip to get Selenium or Playwright? Next step: run those tests on 3,000+ browsers with TestMu AI. Once pip works, install Selenium for Python or install Playwright, then run your Python tests on 3,000+ browsers with TestMu AI (formerly LambdaTest).

Install pip on Mac (python.org vs Homebrew Python)

On a Mac, how you install pip depends on where Python came from. If Python itself is missing, install Python on your Mac first.

  • python.org Python: the installer includes pip. Confirm it with python3 -m pip --version, and run python3 -m ensurepip --upgrade if it's missing.
  • Homebrew Python (brew install python): pip comes with it, but Homebrew marks this Python as externally managed. A plain python3 -m pip install stops with the externally-managed-environment error, so install packages inside a virtual environment (see the last section).

On a Mac, the pip command is usually called pip3. Use python3 -m pip to be sure you're using the pip of the Python you expect.

Install pip on Linux

On Linux, install pip with your distribution's package manager. Debian and Ubuntu disable ensurepip for the system Python, so get-pip.py and ensurepip are the wrong tools there.

# Debian and Ubuntu
sudo apt update
sudo apt install python3-pip

# Fedora
sudo dnf install python3-pip

# Check it
python3 -m pip --version

On Debian and Ubuntu, also install python3-venv (sudo apt install python3-venv) so you can create virtual environments. Recent releases block pip from installing into the system Python, and a virtual environment is the way around that (see the last section).

Upgrade pip

Upgrade pip by running pip through the Python it belongs to:

# Mac and Linux
python3 -m pip install --upgrade pip

# Windows
py -m pip install --upgrade pip

On Windows, always use the py -m pip form for this. A plain pip install --upgrade pip can fail there, because Windows won't let pip.exe replace itself while it's running. Inside a virtual environment, the upgrade changes only that environment's pip. If your pip came from apt or another Linux package manager, let the package manager update it, and upgrade pip only inside virtual environments.

pip vs pip3 vs python -m pip

pip, pip3 and python -m pip all run the same program; the difference is which Python they install packages into. pip and pip3 are small launcher commands tied to whichever Python put them on your PATH, and with several Pythons installed they can point at different ones. python3 -m pip (Windows: py -m pip) always uses the pip of the Python you named, which is why the pip documentation uses that form.

Use the same interpreter to install packages and to run a Python file from the terminal. A package installed with python3 -m pip is always found by python3. To see which Python a pip command belongs to, run it with --version, and check your Python version for each command you use.

Most editors for writing Python can run pip from their own terminal pane.

Fix "pip is not recognized"

The "'pip' is not recognized as an internal or external command" error on Windows means the folder that holds pip.exe (the Scripts folder of your Python install) isn't on PATH. pip itself is usually installed. Fix it one of these ways:

  • Use the launcher: type py -m pip install <package> in place of pip install <package>. It works without any PATH change.
  • Add Python to PATH: with the Python install manager, accept its prompt to add Python to PATH; with the traditional python.org installer, run it again and tick Add python.exe to PATH on its first screen. Or skip PATH and use py -m pip.
  • Open a new terminal: a window that was already open keeps the old PATH.

On a Mac, "zsh: command not found: pip" usually means pip is installed under the name pip3. Use pip3, or better, python3 -m pip.

Fix "externally-managed-environment"

The "error: externally-managed-environment" message comes from PEP 668. Your operating system (recent Debian and Ubuntu releases, for example) or Homebrew manages this Python, and pip refuses to install into it so it can't break tools that depend on it. The fix is a virtual environment for your project:

python3 -m venv .venv
source .venv/bin/activate
python -m pip install requests

Inside the activated environment, pip installs normally; run deactivate to leave it. For a command-line app you want available everywhere, pipx installs each app in its own environment (sudo apt install pipx on Debian and Ubuntu, brew install pipx on Mac). You can also install the distribution's packaged version, such as sudo apt install python3-requests.

Don't add --break-system-packages to get past the error. The flag does what its name says: pip can then overwrite packages your operating system relies on.

Frequently Asked Questions

Does Python come with pip?

Yes. Python 3.4 and later from python.org include pip, installed through the ensurepip module. Some Linux distributions ship pip as a separate package, such as python3-pip on Debian and Ubuntu.

How do I check if pip is installed?

Run python3 -m pip --version (Windows: py -m pip --version). A version line means pip is installed; "No module named pip" means it isn't.

How do I upgrade pip?

Run python3 -m pip install --upgrade pip, or py -m pip install --upgrade pip on Windows. Running it through Python upgrades the pip that belongs to that Python.

Why do I get "externally-managed-environment"?

Your operating system or Homebrew manages that Python, and pip refuses to change it (PEP 668). Create a virtual environment with python3 -m venv .venv, activate it and install your packages there.

Should I use pip or pip3?

Use python3 -m pip (py -m pip on Windows). It always installs into the Python you name, while pip and pip3 can point at different installs when you have more than one.

Related Questions

Test Your Website on 3000+ Browsers

Get 100 minutes of automation test minutes FREE!!

Test Now...

KaneAI - Testing Assistant

World’s first AI-Native E2E testing agent.

...

TestMu AI forEnterprise

Get access to solutions built on Enterprise
grade security, privacy, & compliance

  • Advanced access controls
  • Advanced data retention rules
  • Advanced Local Testing
  • Premium Support options
  • Early access to beta features
  • Private Slack Channel
  • Unlimited Manual Accessibility DevTools Tests