Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Pip Not Recognized: How to Get Pip Working in CMD

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To get pip to work from the command prompt, you must ensure Python is installed and that the Python "Scripts" folder is added to your system's Environment Variables (PATH). If you see the error "'pip' is not recognized as an internal or external command," it usually means Windows knows Python exists but does not know where the pip executable is located. The fastest fix is to rerun the Python installer and check the "Add Python to PATH" box, or to manually add the path to your system settings.

What You'll Need

  • A computer running Windows (this guide focuses on the Windows Command Prompt).
  • Python already installed on your system.
  • Administrator privileges to modify system environment variables.
  • An internet connection if you need to download or repair the Python installation.

Step-by-Step

  1. Verify Python Installation: Open the Command Prompt (cmd.exe) and type python --version. If it returns a version number (e.g., Python 3.12.1), Python is installed. If it opens the Microsoft Store or says the command is not recognized, you need to install Python from the official python.org website first.
  2. Locate the Pip Scripts Folder: Pip is not located in the main Python folder; it resides in a subfolder called "Scripts". To find this, type where python in the command prompt. This will give you a path like C:\Users\YourName\AppData\Local\Programs\Python\Python312\python.exe. Copy this path, but remove "python.exe" from the end and add "Scripts\" to it. Your target path should look like C:\Users\YourName\AppData\Local\Programs\Python\Python312\Scripts\.
  3. Open Environment Variables: Click the Start menu and type "env". Select "Edit the system environment variables". This opens the System Properties window. Click the "Environment Variables..." button at the bottom right.
  4. Edit the Path Variable: In the "System variables" section (the bottom half of the window), scroll down until you find the variable named "Path". Select it and click "Edit".
  5. Add the Scripts Path: In the "Edit environment variable" window, click "New" on the right side. Paste the full path to your Scripts folder that you identified in Step 2. While you are here, ensure the main Python installation folder (the one without "Scripts") is also listed. If it isn't, click "New" again and add that as well.
  6. Save and Exit: Click "OK" on the Edit window, "OK" on the Environment Variables window, and "OK" on the System Properties window. It is critical to click OK on all three windows to ensure the changes are written to the registry.
  7. Restart the Command Prompt: Environment variable changes do not apply to windows that are already open. Close your current Command Prompt window entirely and open a brand new one.
  8. Test Pip: In the new Command Prompt window, type pip --version. You should now see a response indicating the pip version and the location of the package directory.

Common Mistakes

One of the most frequent mistakes is forgetting to restart the Command Prompt. Many users add the path to the environment variables and immediately try the command again in the same window. Because the CMD session loads the PATH variable only once upon startup, it will continue to report that pip is not recognized until the application is restarted.

Another common error is adding the path to the "User variables" instead of "System variables". While adding it to User variables works for the current logged-in user, adding it to System variables ensures that any process or user on the machine can access the Python tools, which prevents permission issues later when running scripts as an administrator.

Users also frequently mistake the Python installation folder for the Scripts folder. If you add C:\Python312 to your path, the python command will work, but pip will not. You must explicitly add the \Scripts subfolder because that is where the pip.exe file actually lives.

Finally, some users try to fix the issue by copying the pip.exe file into the C:\Windows folder. This is a dangerous practice that can clutter system directories and lead to version conflicts if you ever update Python or install multiple versions of the language. Always use the PATH environment variable instead of moving executable files.

Tips

If you are hesitant to manually edit system variables, the easiest way to fix this is to run the Python installer again. Choose the "Modify" option, click "Next", and on the "Advanced Options" page, check the box that says "Add Python to environment variables". This automates the entire process described in the step-by-step section.

To avoid PATH issues entirely, you can use the Python launcher. Instead of typing pip install package, you can type python -m pip install package. The -m flag tells Python to run the pip module as a script. Since you likely already have the main Python executable working, this bypasses the need for the Scripts folder to be in your PATH.

Keep your pip version updated to avoid installation errors with newer packages. Once pip is working, run python -m pip install --upgrade pip. This ensures you have the latest bug fixes and compatibility updates for the package manager.

Troubleshooting

If you have followed the steps and pip --version still fails, first check for multiple Python installations. Type where python. If multiple paths appear, you may have a conflict between a version installed from the website and a version installed from the Microsoft Store. The Microsoft Store version handles paths differently; if you see a path containing "WindowsApps", try uninstalling the Store version and using the official installer from python.org.

If you receive a "Permission Denied" error when trying to install a package, it means pip is working, but it doesn't have the rights to write files to the program folder. To fix this, either run the Command Prompt as an Administrator (right-click the CMD icon and select "Run as administrator") or use the --user flag: pip install --user package_name. This installs the library into your local user directory instead of the system-wide Python folder.

In rare cases, pip may not have been installed at all during the Python setup. To fix this, open the Command Prompt and type python -m ensurepip --default-pip. This command forces Python to install the bundled version of pip if it was skipped during the initial installation process. After running this, you may still need to add the Scripts folder to your PATH as described in the main guide.

Frequently Asked Questions

Does pip come installed with Python?

Yes, in almost all standard installations from python.org, pip is included by default. However, some Linux distributions or custom installation settings may omit it, requiring a separate installation via the ensurepip module.

What is the difference between pip and conda?

Pip is the standard package manager for Python and installs packages from the Python Package Index (PyPI). Conda is a package and environment manager that can install packages for multiple languages (not just Python) and is primarily used with the Anaconda or Miniconda distributions.

Why should I use a virtual environment instead of global pip?

Installing every package globally can lead to "dependency hell," where two different projects require different versions of the same library. Virtual environments (created via python -m venv) create isolated spaces for each project, ensuring that updates to one project don't break another.

Can I use pip in PowerShell instead of CMD?

Yes, pip works in PowerShell. The process for adding Python to the PATH is exactly the same for both. Once the environment variable is set and the shell is restarted, pip will be recognized in both the Command Prompt and PowerShell.

What does the 'pip' command actually do?

Pip stands for "Pip Installs Packages." It connects to the PyPI repository, downloads the necessary files for a library you requested, resolves any dependencies (other libraries that the package needs to work), and installs them into your Python site-packages directory.