What adding pip to your path actually does

Adding pip to your path means telling your operating system where to find the pip command so you can run it from any folder on your computer. Without it in your path, you have to type the full location every time you want to install a Python package. Once it is in your path, you type pip install package-name from anywhere and your system finds it automatically.

Your system path is a list of folders your computer checks when you type a command. If pip is in one of those folders (or rather, if the folder containing pip is listed in your path), the command works. If it is not, you get an error saying the command was not found.

Most Python installations add pip to your path automatically during setup. If yours did not, or if you installed Python in an unusual way, you may need to do it manually. The steps differ depending on whether you use Windows, Mac, or Linux.

Key Takeaways

  • Your system path is a list of folders your computer searches when you type a command; adding pip to it means including the folder where pip lives.
  • On Windows, you add pip to your path through System Properties > Environment Variables, then create or edit the PATH variable to include your Python Scripts folder.
  • On Mac and Linux, you edit your shell configuration file (usually .bash_profile, .bashrc, or .zshrc) to add the Python bin folder to your path.
  • After editing your path, you must close and reopen your terminal or command prompt for the change to take effect.
  • You can test whether pip is in your path by opening a new terminal window and typing pip --version; if it shows a version number, the path is set correctly.

Adding pip to your path on Windows

On Windows, the pip executable lives in a Scripts folder inside your Python installation. To add it to your path, you open the System Properties dialog and edit the PATH environment variable directly.

First, find where Python is installed. Open Command Prompt (search for "cmd" in the Start menu) and type python --version to confirm Python is installed. Then type python -c "import sys; print(sys.executable)" — this shows you the exact folder where Python lives. Note the path, but replace the filename python.exe at the end with Scripts. For example, if Python is at C:\Users\YourName\AppData\Local\Programs\Python\Python311\python.exe, your Scripts folder is C:\Users\YourName\AppData\Local\Programs\Python\Python311\Scripts.

Now open System Properties. Right-click "This PC" or "My Computer" on your desktop or in File Explorer, select Properties, then click "Advanced system settings" on the left. Click the "Environment Variables" button near the bottom. Under "System variables", look for a variable named PATH. If it exists, click it and then click Edit. If it does not exist, click New and type PATH as the variable name.

In the edit window, click "New" and paste your Scripts folder path. Click OK three times to close all the dialogs. Close Command Prompt completely, then open a new Command Prompt window and type pip --version. If you see a version number, pip is now in your path.

Adding pip to your path on Mac and Linux

On Mac and Linux, you edit a hidden configuration file in your home folder to add pip to your path. Which file you edit depends on your shell — the program that reads your commands.

Open Terminal. Type echo $SHELL and press Enter. If the output ends in bash, you are using Bash. If it ends in zsh, you are using Zsh. If it ends in something else, note that name.

For Bash, open Terminal and type nano ~/.bash_profile. If that file does not exist, type nano ~/.bashrc instead. For Zsh, type nano ~/.zshrc. The nano editor opens with the file contents (or a blank file if it is new).

At the end of the file, add a new line: export PATH="/usr/local/bin:$PATH" if you installed Python using Homebrew, or export PATH="$HOME/Library/Python/3.x/bin:$PATH" if you installed Python directly (replace 3.x with your Python version number). Press Control+O, then Enter, then Control+X to save and close the file.

Close Terminal completely and open a new Terminal window. Type pip --version. If you see a version number, the path is set. If you get a "command not found" error, the path you added may be wrong — check that the folder actually contains pip by typing ls /usr/local/bin | grep pip (for Homebrew) or ls ~/Library/Python/3.x/bin | grep pip (for direct installation).

Checking whether pip is already in your path

Before you make any changes, check whether pip is already accessible. Open Command Prompt (Windows) or Terminal (Mac/Linux) and type pip --version. If you see output like "pip 23.1.2 from /path/to/pip", pip is already in your path and you do not need to add it.

If you see "command not found" or "'pip' is not recognized as an internal or external command", then pip is not in your path and you need to follow the steps for your operating system above.

What to do if pip still does not work after adding it to your path

If you have added pip to your path but still get a "command not found" error, the most common cause is that you did not close and reopen your terminal window. Your terminal reads the path settings when it starts, so changes do not take effect until you open a new window.

If you have closed and reopened your terminal and pip still does not work, the path you added may point to the wrong folder. On Windows, open Command Prompt and type dir "C:\Users\YourName\AppData\Local\Programs\Python\Python311\Scripts" (using your actual Python folder) to check whether pip.exe actually exists there. On Mac and Linux, type ls ~/Library/Python/3.x/bin or ls /usr/local/bin to list the files in that folder and look for pip.

Another possibility is that you have multiple Python installations. If you installed Python more than once, or if you use a tool like Anaconda or Miniconda, you may have multiple pip commands in different locations. Type which pip (Mac/Linux) or where pip (Windows) to see which one your system is using. If you want to use a different one, add that folder to your path instead.

Using pip without adding it to your path

If you cannot or do not want to edit your path, you can still use pip by typing the full path to it or by using Python's -m flag. On Windows, type C:\Users\YourName\AppData\Local\Programs\Python\Python311\Scripts\pip install package-name (using your actual Python folder). On Mac and Linux, type ~/Library/Python/3.x/bin/pip install package-name or /usr/local/bin/pip install package-name.

Alternatively, use Python itself to run pip: type python -m pip install package-name on any operating system. This method works regardless of whether pip is in your path, because Python finds its own pip module. Many developers prefer this approach because it is clearer which Python installation you are using.

Frequently Asked Questions

Why does my terminal say "pip: command not found" even though I installed Python?

Python and pip are separate things. Python installs the pip tool, but your system does not know where to find it unless the folder containing pip is listed in your PATH environment variable. You need to add that folder to your path manually, or use python -m pip instead of typing pip directly.

Do I need to restart my computer after adding pip to my path?

No. You only need to close your terminal or command prompt window completely and open a new one. Your system reads the path settings when the terminal starts, so a new window will pick up the changes without restarting your computer.

What is the difference between pip and pip3?

On systems with both Python 2 and Python 3 installed, pip usually refers to Python 2's package manager and pip3 refers to Python 3's. Since Python 2 is no longer supported, you should use pip3 if your system offers it, or just pip if you only have Python 3 installed. Type pip --version to see which Python version your pip is tied to.

Can I add multiple Python installations to my path?

You can add multiple folders to your PATH, but only one pip command will run when you type pip — the one in the first folder your system finds. If you need to use different Python versions, use python3.9 -m pip, python3.11 -m pip, and so on to specify which version you want, or use a tool like pyenv or virtualenv to manage multiple installations.

Is it safe to edit the PATH variable?

Yes, as long as you add to it rather than replace it. When you edit PATH, make sure you keep all the existing folders and only add your pip folder to the list. If you accidentally delete existing folders from PATH, your system may not find other important commands. If this happens, you can undo it by removing what you added and restarting your terminal.