UPDATED BY
Brennan Whitfield | May 09, 2024

Let’s say you receive an error message from Git Bash.

bash: pip: command not found

And an error message from DOS command line.

'pip' is not recognized as an internal or external command,
operable program or batch file.

What do you do? 

 

What Is a ‘Pip: Command Not Found’ Error? 

First things first: A “pip: command not found” error message occurs when pip, the standard package installer for Python, is not correctly installed on the system or added to the system’s PATH. Pip is included by default with Python 3.4 or later versions, so this error may occur if you have installed an earlier version of Python or haven’t added Python to your system PATH during installation. To fix this error, you will either need to re-install Python and check the box to add Python to your system PATH or install pip on your command line.

 

How to Fix ‘Pip: Command Not Found’ and Install Pip

First, make sure pip is installed on your system, as this may be the reason it is unable to be found. 

If you’ve just installed Python, you may want to rerun your Python installer and make sure you check the box “Add Python to PATH.”

pip command not found Python installer image
Python for Windows installer page. | Screenshot: Ashley Gelwix

Next, click “Customize installation” and check the “pip” box under Optional Features. 

pip command not found python installer optional features
Check the install pip checkbox. | Screenshot: Ashley Gelwix

Then, click “Next” to get to Advanced Options and check the “Add Python to environment variables” box. Adding Python to environment variables ensures that the Scripts folder with pip3.exe in it can be found. 

pip command not found advanced options screenshot
Mark “Add Python to environment variables” in advanced options. | Screenshot: Ashley Gelwix

After checking the appropriate boxes, click “Install.”

Next, open your terminal in Windows and check for pip3.exe using the following command to ensure it’s downloaded on your computer:

C:\Users\YOUR_USERNAME\AppData\Local\Programs\Python\Python36\Scripts

Note that you can’t copy and paste that line. You will need to fill in your actual username and ensure the Python version number matches with the version you’re installing in that path. For example, since we’re installing Python version 3.6, it says “Python36” in its part of the path.

If you do find “pip 3,” you are in luck. It should look something like the image below.

pip command not found pip3 folder screenshot
The pip3.exe folder on Windows. | Screenshot: Ashley Gelwix

If you’re navigating on Windows, you can get to the AppData folder by typing the %appdata% macro into the path bar in a Windows File Explorer (formerly Windows Explorer) window.

pip command not found AppData search screenshot
Search %appdata% to get to the appdata folder on Windows. | Screenshot: Ashley Gelwix

If you can’t find the pip3.exe, it might not be installed. So, check to see that you did install pip correctly. It’s easy to pass over these little things, and you may have missed it the first time through.

More on Coding ErrorsHow to Prevent Kubernetes Configuration Errors

 

How to Add Pip to System PATH Using Command Line

If pip is installed but showing a “not on PATH” error, it must be added to Windows environment variables in order to be added to the system’s PATH. This is can be done if you use the Python official installer, but if you don’t want to run it again you can add pip to the system PATH using the command line. 

It is also possible that you may have skipped over this warning right after summoning Python from the command line or after installation.

WARNING: The scripts pip.exe, pip3.6.exe and pip3.exe are installed in 'C:\Users\YOUR_USERNAME\AppData\Local\Programs\Python\Python36\Scripts' which is not on PATH.
 Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

It’s easy to miss, and I think developers get into the habit of ignoring warnings like this because code often compiles with thousands of compiler warnings. 

1. Search “Environment” on Windows and Click “Edit the system environment variables”

Now, let’s edit your path. Start by searching for “environment” in your Windows search tab.

pip command not found environment variables screenshot
Search “environment” and edit the environment variables. | Screenshot: Ashley Gelwix

Then select, “Edit the system environment variables.”You will see a window like this below.

2. Click Environment Variables

pip command not found system properties screenshot
In system properties, select environment variables. | Screenshot: Ashley Gelwix

Click the button the green arrow is pointing to labeled “Environment Variables.”

3. Select the Path Variable Under System Variables

pip command not found environment variables path
Select the Path you want to edit. | Screenshot: Ashley Gelwix

You will then have a choice. You can either edit the user path or the system path. 

I usually edit the system path and have never run into issues. However, I suspect that the safer thing to do, the more “principle-of-least-privilege” thing to do, would be to edit the user path. That way only the user who needs pip access will have it. It’s up to you, but I typically never have more than one user on my machine. However, many workplaces do.

4. Click Edit for the Selected Path

pip command not found edit paths screenshot
Click the Edit button for whichever path you chose

After selecting your path variable, click “Edit.”

5. Click New and Paste the Path Line With Your Username

pip command not found edit environment variable screenshot
Paste in the Path and click OK. | Screenshot: Ashley Gelwix

From here, you’ll want to copy the path we discussed earlier into the new line.

C:\Users\YOUR_USERNAME\AppData\Local\Programs\Python\Python36\Scripts

Make sure you use your actual username in the place of YOUR_USERNAME, and that the Python version number matches the version you installed. Remember, you can’t just copy paste it. While you’re here, it’s also not a bad idea to add Python to your path. So, add this folder, too. It’s just one level up:

C:\Users\YOUR_USERNAME\AppData\Local\Programs\Python\Python36\

If you can’t open the path in File Explorer, it’s not a real path.

6. Click OK After Pasting Path

Once you’ve pasted in the new path to the end of the path system environment variable, you can click OK to close the window.

7. Restart Terminal and Type ‘pip’ to Check Installation

Next you need to restart the command line terminal, and type in “pip” to check your work. If it works, you should see the help output in the terminal. It should look something like the image below.

pip command not found help output in terminal screenshot
Pip help output in terminal. | Screenshot: Ashley Gelwix

If you don’t see it, you should go back to your path environment variable and make sure it is correct. Watch out for spaces in the wrong place, extra characters, etc.

The example path I gave you is on the C:/ drive. If you installed pip and Python to a different drive, use that one instead.

More on PythonPython Tuples vs. Lists: When to Use Tuples Instead of Lists

8. Optional: Update Pip PATH Variable Using Bash

Alternatively, you could do this in your ~/.bashrc file for Git Bash.

Enter, vim ~/.bashrc to open the bashrc file. This is a file that executes every time you open a shell window. You’ll have to re-open your shell to get the changes that you make to the bashrc file.

alias pip='C:\\Users\\YOUR_USERNAME\\AppData\\Local\\Programs\\Python\\Python36\\pip3.exe'

A few other things to note:

  • You MUST use single quotes as double quotes will not work.
  • You MUST escape your \ slashes.
  • You MUST use Windows style slashes (\). Unix style (/) will not work.
  • You MUST escape your spaces in the path. If YOUR_USERNAME has a space you would enter the following: 
    alias pip='C:\\Users\\YOUR\ USERNAME\\AppData\\Local\\Programs\\Python\\Python36\\Scripts\\pip3.exe'

This can be handy if you don’t think you should edit the path. There’s more than one way to crack an egg. Creating an alias will just make pip automatically call that pip3.exe you pointed it to. However, you may need to add the “Scripts” folder to the path in order to find some modules you installed. 

On Windows especially, it seems to nearly always be safe to append to the path. But I always do that little trick to make sure I have an alias around just in case.

 

Frequently Asked Questions

How to fix pip not found?

To fix a “pip: command not found” error, make sure pip is installed and added to your system’s PATH. This can be done by downloading the latest version of Python and checking the “Add Python to PATH” box, the “pip” box (under Optional Features) and the “Add Python to environment variables” box (under Advanced Options) in the Python installer. Pip can also be installed and added to a system PATH manually using command line.

How to install pip command in Python?

Pip can be installed in Python on Windows by using the get-pip.py command directly in command line.

First, download get-pip.py. Then to install pip, use the command: 

python get-pip.py

Why don't I have pip in Python?

Pip is only included with Python 3.4 and later versions, and must have the “Add Python to PATH” box, “pip” box and “Add Python to environment variables” box checked during installation to be recognized by the system and used with Python.

Expert Contributors

Built In’s expert contributor network publishes thoughtful, solutions-oriented stories written by innovative tech professionals. It is the tech industry’s definitive destination for sharing compelling, first-person accounts of problem-solving on the road to innovation.

Learn More

Great Companies Need Great People. That's Where We Come In.

Recruit With Us