pip Is Not Recognized: How to Fix "pip not found" on Windows, Mac and Linux
If your terminal says pip is not recognized or command not found: pip, stop typing pip and run it through Python instead: python -m pip install <package>. On Windows use py -m pip install <package>; on Mac and Linux use python3 -m pip install <package>. It works whenever Python itself works.
# Windows (Command Prompt or PowerShell)
py -m pip install requests
# macOS and Linux
python3 -m pip install requests
The rest of this page explains why the plain pip command goes missing, gives the fix for each operating system, and covers the Linux externally-managed-environment error that looks like the same problem but is not.
The error messages this page fixes
The wording depends on your shell, but they all mean the same thing: the shell searched every folder on your PATH and found no program called pip.
'pip' is not recognized as an internal or external command,
operable program or batch file.
pip : The term 'pip' is not recognized as the name of a cmdlet, function,
script file, or operable program.
zsh: command not found: pip
bash: pip: command not found
The first is Command Prompt, the second is Windows PowerShell (PowerShell 7 words it slightly differently), the third is the default Mac terminal, and the last is Linux.
Why python -m pip is the fix that always works
pip is not part of the shell. It is a Python package, and the pip command is a small launcher file that the installer drops into a folder next to Python. If that folder is not on your PATH, the launcher cannot be found, even though pip itself is installed and working.
python -m pip skips the launcher. The -m flag tells Python to find the module called pip and run it. As a bonus, it removes a common placement-lab headache: when a machine has two Pythons, a bare pip can install a package into one Python while your script runs on the other. With python -m pip, the package always goes to the Python you named.
You can check which Python you are talking to, and whether it has pip, from Python itself:
import sys
import importlib.util
print(sys.version_info >= (3, 12))
print(importlib.util.find_spec("pip") is not None)
# True
# True
Run print(sys.executable) as well to see the full path of the interpreter. If find_spec("pip") prints False, that Python has no pip at all; python -m ensurepip --upgrade installs the copy that ships with Python.
Fix pip not recognized on Windows
1. Use the py launcher
The python.org installer for Windows includes the py launcher, which is usually on PATH even when python and pip are not. Try:
py --version
py -m pip --version
py -m pip install requests
If py -m pip --version prints a version and a path, pip is fine and only the PATH is missing. You can keep using py -m pip and never fix anything else.
2. Tick "Add python.exe to PATH"
The installer has a checkbox on its first screen labelled "Add python.exe to PATH". It is unticked by default, and leaving it unticked is the most common reason for this error. Run the installer again, choose Modify, and tick "Add Python to environment variables" on the Advanced Options page, or uninstall and reinstall with the box ticked. Close and reopen the terminal afterwards: a terminal that was already open keeps the old PATH.
3. Add the Scripts folder by hand
pip.exe lives in a Scripts folder inside the Python install, not next to python.exe. For a per-user install of Python 3.12 that is:
C:\Users\<you>\AppData\Local\Programs\Python\Python312\
C:\Users\<you>\AppData\Local\Programs\Python\Python312\Scripts\
Search the Start menu for "Edit environment variables for your account", open Path, and add both folders. A classic mistake is adding only the first one: python then works and pip still does not.
4. Watch out for the Microsoft Store alias
If typing python opens the Microsoft Store instead of Python, Windows is using an "app execution alias". Turn off the python.exe and python3.exe aliases under Settings, Apps, Advanced app settings, App execution aliases, then reopen the terminal.
A clean install with these screens walked through step by step is in How to install Python on Windows, Mac and Linux.
Fix pip not found on Mac
macOS does not give you a pip command. The Python from python.org and the one from Homebrew both install the commands as python3 and pip3, so pip on its own is not found:
python3 -m pip --version
pip3 install requests
If python3 itself is missing, install it with Homebrew (brew install python) or the python.org installer. Homebrew's Python is marked as externally managed, so a plain pip3 install into it is refused with the same externally-managed-environment error described in the Linux section below. The fix is identical: use a virtual environment.
Fix pip command not found on Linux
On Debian and Ubuntu, Python is installed but pip is a separate package:
sudo apt update
sudo apt install python3-pip python3-venv
python3 -m pip --version
Fedora uses sudo dnf install python3-pip. As on Mac, the command is pip3 or python3 -m pip, not pip.
The externally-managed-environment error
On Ubuntu 23.04 and later, Debian 12 and later, and Homebrew on Mac, installing pip is not the end of the story. Try to install a package and you get:
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.
...
This is deliberate (PEP 668). The operating system's own tools are written in Python and depend on the package versions it installed; if pip overwrote them, parts of the system could break. So the system Python refuses pip install.
Further down, the same message mentions --break-system-packages. That flag switches the protection off, and the name is an honest description of the risk. Do not use it. Use one of these instead:
- A virtual environment for any project or college assignment (next section).
- pipx for command-line tools you want everywhere, such as
blackorhttpie. pipx gives each tool its own private environment and puts the command on your PATH:
sudo apt install pipx
pipx ensurepath
pipx install black
- apt for a library the system already packages, for example
sudo apt install python3-requests.
The real fix: use a virtual environment
A virtual environment (venv) is a private folder with its own Python and its own pip. Inside an activated venv, plain pip always works, on every operating system, and nothing you install touches the system Python or your other projects. This is the habit every Python job expects.
# create it once, inside your project folder
python -m venv .venv # Windows (or: py -m venv .venv)
python3 -m venv .venv # macOS and Linux
# activate it every time you open a new terminal
.venv\Scripts\activate # Windows Command Prompt
.venv\Scripts\Activate.ps1 # Windows PowerShell
source .venv/bin/activate # macOS and Linux
# now plain pip works
pip install requests
Your prompt shows (.venv) while it is active, and deactivate leaves it. If PowerShell refuses to run Activate.ps1 because running scripts is disabled, run Set-ExecutionPolicy -Scope CurrentUser RemoteSigned once and try again.
Python can also tell you whether a venv is active. Inside one, sys.prefix points at the venv folder while sys.base_prefix still points at the Python it was created from:
import sys
in_venv = sys.prefix != sys.base_prefix
print("Inside a virtual environment:", in_venv)
# Inside a virtual environment: False
That is the output from a normal terminal. Activate a venv, run the same file again, and it prints True.
A 30-second checklist
- Run
python -m pip --version(py -m pipon Windows,python3 -m pipon Mac and Linux). If it prints a version, pip works; use that form. - If it says there is no module named pip, run
python -m ensurepip --upgrade, or on Linuxsudo apt install python3-pip. - If Python itself is not found, fix the install and PATH first, then reopen the terminal.
- If you see
externally-managed-environment, create a venv. Do not reach for--break-system-packages.
Skip pip entirely while you learn
If you only want to practise, you do not need pip at all. PyRun runs real Python in your browser with no install. In the playground, import numpy or import pandas installs the package on first import, and the Python terminal gives you a REPL in a browser tab.
Once your local setup works, the modules and imports lesson explains what import actually looks up, and the packaging with pyproject lesson shows how to declare your own project's dependencies so that one pip install sets everything up. Both have runnable examples and graded exercises, and the first five lessons are free.