How To Fix “Pip Is Not Recognized As An Internal Or External Command” In Windows

Pip Is Not Recognized As An Internal Or External CommandPip Is Not Recognized As An Internal Or External Command

According to Statista, Python is the 4th most used programming language in the world (in 2022). Programmers often install it on their Windows computers to develop applications. However, we have seen users report that they often encounter trouble when trying to install or modify the Python packages using the “PIP” command.

The most common error reported amongst developers is the following:

Pip is not recognized as an internal or external command.

The Pip Installation Packages (PIP) is a Python package management system used to install and manage its software packages. However, while using it to perform certain tasks, like installing another package using the command “pip install Django”, the aforementioned error is encountered.

In this post, we are going to address this issue so that you may continue with your Python development as planned.

Why is Pip Command Not Found in Windows

When a user encounters the “Pip is not recognized as an internal or external command” error, it is due to one of the following reasons:

  • Pip has not been added to the environment variables.
  • The pip environment variable has incorrect values.

Environment variables are variables that can be used across your system. Just like in programming, variables contain a value that can be changed or called when needed. Environment variables are the same, but can be used across the entire scope.

When pp is not recognized, it is probably because the command line is unable to call on the actual program because of the missing or incorrect path.

Let us show you how to check whether a path for “pip” is present inside the Windows environment variables list.

How to Check Environment Variable for Pip

The most convenient method to check that pip was added to the PATH variable is using the Command Prompt. Follow these steps to check whether it is present or not:

  1. Launch an elevated Command Prompt.

  2. Run the following cmdlet:

    echo %PATH%
  3. Ensure that a similar path is present in the presented variables:

    C:\Users\[Username]\AppData\Local\Programs\Python\PythonXXX\Scripts
    Check if Python environment variable exists using Command Prompt
    Check if the Python environment variable exists using Command Prompt

    The username and the “XXX” are dependent upon your user account name and the installed Python version.

You can also view the environment variables from the Settings app, and through PowerShell.

If you find that such a variable doesn’t exist, then it means that the issue is caused because of a missing pip variable in PATH. However, if one does exist, then it is likely that its value is misconfigured.

Either way, continue to perform the following mitigation tasks to correct the error and get on with your Python development.

Fix PIP Not Recognized in Windows

Add Environment Variable for PIP

This section covers 2 ways to add the environment variable for PIP. Of course, you only need to perform this if the Python directory did not show up in the list of environment variables when you checked for them using the Command Prompt above.

Add PIP Environment Variable using System Properties

This method shows how to add the PIP environment variable to PATH using Windows GUI.

  1. Open the System Properties applet by typing in “sysdm.cpl” in the Run Command box.

    sysdm
    Open System Properties applet
  2. Switch to the Advanced tab.

    Open Advanced tab 1
    Open Advanced tab
  3. Click “Environment Variables.”

    Open Environment Variables
    Open Environment Variables
  4. Under the System Variables section, select “Path,” and then click Edit.

    Edit PATH
    Edit PATH
  5. From the popup window, click New.

    Add new environment variable
    Add new environment variable
  6. Now enter the path for the PythonXXX directory, as in the following image:

    Enter path for Python directory
    Enter path for Python directory

    Note: You can use File Explorer to navigate to the Python directory and copy the correct path from there.

    Copy path using File Explorer
    Copy path using File Explorer
  7. Now click New again and enter a second path for the Scripts directory.

    Enter path for Scripts directory
    Enter path for Scripts directory
  8. Click Ok on all windows to save the changes.

The environment variables will now be added to PATH.

Add PIP Environment Variable using Command Prompt

You can also add the PIP environment variable using the Command Prompt in just a few commands. Here is how:

  1. Launch an elevated Command Prompt.

  2. Use the following cmdlet while changing the [Username] and [XXX] with your account name and Python version to add the PIP environment variable to PATH:

    setx PATH “%PATH%; C:\Users\[Username]\AppData\Local\Programs\Python\PythonXXX
    Add path to Python directory using Command Prompt
    Add path to Python directory using Command Prompt

Edit Environment Variable for Python

If the Python directory did show up when you were checking the variables list, and the PIP command still isn’t working, then it is probably misconfigured.

Use the following steps to edit the existing PATH variable:

  1. Open the System Properties applet by typing in “sysdm.cpl” in the Run Command box.

    sysdm
    Open System Properties applet
  2. Switch to the Advanced tab.

    Open Advanced tab 1
    Open Advanced tab
  3. Click “Environment Variables.”

    Open Environment Variables
    Open Environment Variables
  4. Under the System Variables section, select “Path,” and then click Edit.

    Edit PATH
    Edit PATH
  5. Select the Python entry and click Edit.

    Edit the path
    Edit the path
  6. Repeat the steps above for the other path (if needed).

  7. Click Ok on all windows to save the changes.

Ensure PIP is Included in Python Installation

Python has different components installed. Ensure that PIP is one of the installed components using these steps:

  1. Open the Programs and Features applet by typing in “appwiz.cpl” in the Run Command box.

    appwiz
    Open Programs and Features applet
  2. Right-click Python and then click Modify from the context menu.

    Modify Python installation
    Modify Python installation

    The modification wizard will now launch.

  3. Click Modify.

    Select Modify
    Select Modify
  4. Make sure that “pip” is selected, then click Next.

    Ensure pip is selected
    Ensure “pip” is selected
  5. Now ensure that “Add Python to environment variables” is selected, and then click Install.

    Add environment variables
    Add environment variables

    Any newly selected packages and variables will now install.

  6. When the installation completes, close the wizard.

    Close the modification wizard
    Close the modification wizard

If this resolution did not work for you, you can try and reinstall Python all together.

Reinstall Python with PATH Variable

Another workaround for the error prompt is to reinstall Python on your PC. When installing Python, it gives you the option to place the environment variables into PATH.

Follow these steps to uninstall Python and then reinstall it properly.

  1. Open the Programs and Features applet by typing in “appwiz.cpl” in the Run Command box.

    appwiz
    Open Programs and Features applet
  2. Right-click Python and then click Uninstall.

    Uninstall Python
    Uninstall Python

    The uninstallation wizard will now run and remove Python from your PC.

  3. Close the wizard and restart the computer.

    Close uninstallation wizard 2
    Close uninstallation wizard
  4. Now download the Python setup and run it.

  5. From the installation wizard, select “Add pythno.exe to PATH” and then click “Install Now.”

    Add PATH for Python and install
    Add PATH for Python and install

    The installation will now begin.

  6. When installed, close the wizard.

    Close the installer
    Close the installer

A fresh environment variable path has now been added to the system. Check to see if your issue has been resolved and that PIP is recognized now.

Install Python Package without PIP Variable

If none of these solutions have worked for you, then another workaround is to install a Python package without adding the PIP variable. It can be done using a simple cmdlet in Command Prompt.

  1. Launch an elevated Command Prompt.

  2. Use the following cmdlet to install a Python package while replacing [PackageName] with the name of the package:

    python -m pip install [PackageName]
    Install Python package without PIP variable
    Install Python package without PIP variable

As you can see in the image above, the Django package has been installed without adding the pip variable in PATH.

Final Words

The Pip Installation Packages is a crucial command for managing Python libraries and packages. Therefore, you need to ensure that it is working correctly on your PC in order to maximize productivity.

Let us know which method from above worked for you in resolving the issue.

If you liked this post, Share it on:
Subhan Zafar is an established IT professional with interests in Windows and Server infrastructure testing and research, and is currently working with Itechtics as a research consultant. He has studied Electrical Engineering and is also certified by Huawei (HCNA & HCNP Routing and Switching).

Leave the first comment

Get Updates in Your Inbox

Sign up for the regular updates and be the first to know about the latest tech information

Talk to us now

Talk to us straight and get your questions answered right away

Tell Us About Your Project