The term 'pip' is not recognized as the name of a cmdlet

avatar
Borislav Hadzhiev

Last updated: Apr 4, 2024
4 min

banner

# The term 'pip' is not recognized as the name of a cmdlet

The error "The term 'pip' is not recognized as the name of a cmdlet, function, script file, or operable program" occurs for 2 main reasons:

  1. Not having the path to pip in your user's PATH environment variable.
  2. Not having pip installed on your machine.

the term pip is not recognized as the name of cmdlet

PowerShell
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. At line:1 char:1 + pip install requests

The first thing you can try is to use the python -m pip command.

PowerShell
python -m pip install requests py -m pip install requests python3 -m pip install requests

using python m pip

This often works even when you don't have the path to pip in your PATH environment variable.

However, a better solution is to add the path to Python and pip to your PATH environment variable.

# Add the path to Python and pip to your user's PATH environment variable

To add the path to Python and pip to your user's PATH environment variable:

  1. Click on the Search bar and type "environment variables".
  2. Click on "Edit the system environment variables".

edit system environment variables

  1. Click on the "Environment Variables" button.

click environment variables

  1. In the "User variables for YOUR_USER" section, select the "Path" variable and click "Edit".

select user path click edit

  1. Click on "New" and then click "Browse".

click new browse

  1. You can use one of the following commands to check where your Python installation is located.
cmd
python -c "import os, sys; print(os.path.dirname(sys.executable))" where python

find python path

For me, the path is the following.

cmd
C:\Users\YOUR_USER\AppData\Local\Programs\Python\Python310

Note that I have Python 3.10 installed, which is reflected in the PATH.

  1. Add the path to Python and then add the path to the Scripts directory that is located in your Python3X folder.

    This is where the executable files are located, including pip.exe.

For me, it is the following path.

cmd
C:\Users\YOUR_USER\AppData\Local\Programs\Python\Python310\Scripts

add scripts folder

  1. Once the two paths are added, confirm the changes by clicking on the "OK" button twice.

added python and pip to path

  1. Close your Command prompt application and your Power Shell session and then reopen your shell.
Note that you must restart your Command prompt application and Power Shell for the changes to take effect.

You might also have to restart your PC, but that's not always necessary.

PowerShell
pip --version pip install requests

powershell pip works

If you still get an error when issuing pip commands, use the official installer to configure Python correctly.

# Adding Python and pip to your PATH using the official installer

If you still encounter issues, try to add Python to your PATH using the official installer.

  1. Download the installer from the official python.org website.

  2. If you have Python already installed, start the installer and click on "Modify".

click modify

You can leave the optional features ticked. Note that the pip checkbox is checked.

optional features

  1. On the "Advanced Options" screen, make sure to tick the "Add Python to environment variables" option.

add python to environment variables

  1. Once the "Add Python to environment variables" checkbox is checked, click "Install".
Now your Python installation should be set up correctly and Python should be added to your user's PATH environment variable.

If that didn't work, your Python installation might be corrupted.

# Reinstalling Python on your Windows machine

Start the installer again and click on "Uninstall".

uninstall python

Now that you don't have Python installed on your machine, start the installer again and make sure to tick the "Add python.exe to PATH" option.

add python exe to path

The checkbox won't be checked by default.

Once the "Add python.exe to PATH" checkbox is checked, click on "Install Now".

After the installation, Python will be installed and configured properly.

Close your Power Shell application and reopen it.

Note that you must restart Power Shell for the changes to take effect.

PowerShell
pip --version pip install requests

If the error is not resolved, run the following command to install pip.

PowerShell
python -m ensurepip --upgrade py -m ensurepip --upgrade python3 -m ensurepip --upgrade

If the error persists, try to restart your PC.

# Conclusion

To solve the error "The term 'pip' is not recognized as the name of a cmdlet, function, script file, or operable program", make sure:

  1. You have the path to pip in your user's PATH environment variable.
  2. You have pip installed on your machine.

# Additional Resources

You can learn more about the related topics by checking out the following tutorials:

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.