'pip' is not recognized as an internal or external command
1 · The lesson
readWhat this error means
The terminal looked for a program called pip and didn't find it. pip is the tool that installs Python packages. It is installed together with Python, but the pip command lives in a separate folder (Scripts on Windows), and that folder often isn't on your PATH, the list of folders the terminal searches. Python itself may work fine. This is not a Python error, because neither Python nor pip ever started.
When you see it
In Command Prompt:
C:\Users\Ada> pip install requests 'pip' is not recognized as an internal or external command, operable program or batch file.
In PowerShell:
PS C:\Users\Ada> pip install requests pip : The term 'pip' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
On macOS and Linux the same problem reads zsh: command not found: pip or bash: pip: command not found. Ubuntu may add Command 'pip' not found, but can be installed with: sudo apt install python3-pip.
Why it happens
1. The Scripts folder isn't on PATH. The Windows installer from python.org has a box, Add python.exe to PATH, which is not ticked by default. Without it, neither python nor pip is found. Even with it ticked, some setups add the Python folder but not its Scripts folder, so python works and pip doesn't.
2. On macOS and Linux the command is pip3. Many systems only install pip3 and python3. Plain pip and python may not exist at all, or may point to something else.
3. pip isn't installed for that Python. On Debian and Ubuntu, pip is a separate system package, python3-pip. Some custom or minimal Python installs leave pip out too.
4. The terminal was open during the install. A terminal reads PATH once, when it opens. If you installed Python, or changed PATH, while it was open, it still has the old list.
How to fix it
Run pip through Python. This works almost everywhere and is the recommended way anyway. Instead of pip, write py -m pip on Windows, or python3 -m pip on macOS and Linux:
py -m pip install requests
python3 -m pip install requests
-m pip means "run the pip module with this Python". It doesn't depend on the Scripts folder being on PATH. It also installs into exactly the Python you named, which avoids the classic problem where pip installs into one Python and your code runs with another.
Inside a virtual environment, plain pip works. Activating a virtual environment puts its own pip first on PATH:
py -m venv .venv .venv\Scripts\activate pip install requests
If py -m pip says No module named pip, pip itself is missing. Python can install it:
py -m ensurepip --upgrade
On Debian and Ubuntu, install the system package instead: sudo apt install python3-pip.
If you want the plain pip command on Windows, run the python.org installer again, choose Modify, and tick Add Python to environment variables. Then close and reopen the terminal. To see which folder needs to be on PATH, ask Python:
import sysconfig print(sysconfig.get_path("scripts")) # the folder that holds pip.exe
When you'd see this in real code
- A tutorial says
pip install pandas, and you are on a fresh Windows install where Python came from python.org with the default options. - In VS Code, the terminal panel was opened before Python was installed. Closing that terminal and opening a new one fixes it.
- On a Mac,
pip installfails butpip3 installworks, because the system only providespip3. - In a Dockerfile based on a minimal Debian or Ubuntu image,
RUN pip install ...fails untilpython3-pipis installed or apython:base image is used.
Related errors
- 'python' is not recognized as an internal or external command: the same
PATHproblem for Python itself. If both fail, fix this one first. - error: externally-managed-environment: pip runs, but refuses to install into the Python your operating system owns.
- ModuleNotFoundError: No module named 'X': pip installed the package into a different Python than the one running your code.
- error: Microsoft Visual C++ 14.0 or greater is required: pip runs, but can't build the package on Windows.
See Also
- All Python errors: the full index, by type and by when it happens.
- Virtual environments
- pip and the standard library
- How to use the terminal
Found this useful? Share it with a friend who’s learning Python.