Python windows pip path

Author:
Joel Gray

Published: 18 October 2023
Read Time: ~2 minutes

Are you sick of adding “python -m” to the beginning of your pip install commands?

Or maybe you’ve reinstalled python and realise that now you have to write “python -m pip install package” instead of just “pip install package”?

This short and simple blog will show you how to add pip to your system’s environment path, which means it will know how to find pip without prefixing it with “python -m”.

For macOS and Linux:

1. Locate pip Installation:

• Run the following command in your terminal to find where pip is installed:

python -m site --user-base

• Note the path returned, e.g., /home/username/.local.

2. Modify the PATH Environment Variable for this session:

• Append /bin to the path obtained, e.g., /home/username/.local/bin.

• For a temporary modification, run:

export PATH="$PATH:/home/username/.local/bin"

3. Modify the PATH Environment Variable permanently:

• For a permanent modification, add the above line to your ~/.bashrc (for Linux) or ~/.bash_profile (for macOS) file:

echo 'export PATH="$PATH:/home/username/.local/bin"' >> ~/.bashrc
source ~/.bashrc

4. Verify the Modification:

• Open a new terminal window and run:

pip --version

For Windows:

1. Locate pip Installation:

• Run the following command in your Command Prompt to find where pip is installed:

py -m site --user-site

• Note the path returned, e.g., C:\Users\Username\AppData\Roaming\Python\Python39\site-packages.

2. Modify the PATH Environment Variable:

• Navigate to the Scripts directory which is a sibling to the site-packages directory, e.g., C:\Users\Username\AppData\Roaming\Python\Python39\Scripts.

• Copy this path.

3. Add the Path to the Environment Variables:

• Right-click on ‘This PC’ or ‘My Computer’ on your desktop or in File Explorer, and select ‘Properties’.

• Click on ‘Advanced system settings’.

• Click on ‘Environment Variables’.

• Under ‘System variables’, scroll down and select the ‘Path’ variable, then click on ‘Edit’.

• Click on ‘New’, and paste the path copied earlier.

• Click ‘OK’ to close each window.

4. Verify the Modification:

• Open a new Command Prompt window and run:

pip --version

PIP stands for “Preferred Installer Program” or “Pip Installs Packages” and is a standard package manager for Python that enables users to install and manage additional libraries and dependencies not included in the standard Python library. To use PIP, you must install Python on your Windows machine.

This article provides a step-by-step guide on how to install and configure PIP on Windows, along with tips for managing Python packages effectively.

Prerequisities:

  • Windows (11, 10, 8 , 7)
  • Python (version 3.13.1)
  • Admin Rights

Verify Python Installation

Before installing PIP, you need to ensure that Python is already installed on your system. You can check this by running the following command in the command prompt

python --version

If it is installed, You will see something like this:

Python 3.13.1

If it is not installed, you can install it with the help of this article: How to install Python on Windows.

To get more knowledge about Python packages or modules, get hands-on in our Python course. This course will offer you basic to advanced insights into Python programming.

Installing Python PIP on Windows

Installing pip in Windows is very easy. You just need to follow the given steps to install pip and some additional steps to finally use it. By these steps, we can see how to pip install on Windows. To ensure proper installation and use of pip we need to tick this checklist to install pip Python:

  1. Download PIP
  2. Install PIP
  3. Verify Installation
  4. Add pip to environment variables

1. Download PIP

To install PIP, you’ll need the get-pip.py script. Let’s understand this in the below-mentioned detailed steps:

Method 1. Install Python pip using Python cURL

Curl is a UNIX command that is used to send the PUT, GET, and POST requests to a URL. This tool is utilized for downloading files, testing REST APIs, etc.

Note: It will download the get-pip.py file.

Follow these instructions to pip windows install:

Step 1: Open Command Prompt

Press Win + R and type CMD and hit the enter button to open the cmd terminal using the Windows keyboard shortcut or alternatively, click on Start Menu and type “Command Prompt” and hit the enter button.

cmd-as-admin

Start Menu – Command Prompt – Run as admin

2. Installing PIP

Here, we have now used cURL to transfer the data requests, let’s check out the executed command in here:

Step 2: Transfer Data Request from a Server

In python, a curl is a tool for transferring data requests to and from a server. Use the following command to request:

https://bootstrap.pypa.io/get-pip.py
python get-pip.py

Method 2. Manually Download and Install Python PIP on Windows

Python pip must be manually installed on Windows. We can pip install in Python by manually installing it. You might need to use the correct version of the file from pypa.io if you’re using an earlier version of Python or pip. Get the file and save it to a folder on your PC.

1.1 Download PIP

This is another method for downloading PIP manually. Let’s check down the steps below:

Step 1: Download the get-pip-py Script

Download the get-pip.py (https://bootstrap.pypa.io/get-pip.py) file and store it in the same directory as Python is installed.

Step 2: Change the Directory

Change the current path of the directory in the command line to the path of the directory where the above file exists.

2.2 Installing PIP

Now, in the next two steps, we will understand how you can install PIP in Python environment. Let’s check them out:

Step 3: Execute the command to Install Python

get-pip.py is a bootstrapping script that enables users to install pip in Python environments. Here, we are installing pip python3. Run the command given below:

python get-pip.py

Step 4: Wait Untill You Get the Confirmation

Now wait through the installation process. Voila! pip is now installed on your system.

3. Verify the PIP Installation

One can easily verify if the pip has been installed correctly by performing a version check on the same. Just go to the command line and execute the following command:

pip -Vorpip --version

4. Adding PIP to Windows Environment Variables

If you are facing any path error then you can follow the following steps to add the pip to your PATH. You can follow the following steps to adding pip to path Windows 10 and set the Path:

Step 1: Locate te PIP installation directory

  • You are likely to get this in: C\Python33\Scripts\

Step 2: Add to the PATH

  • Go to System and Security > System in the Control Panel
  • On the left side, click the Advanced system settings link.
  • Then, select Environment Variables.
  • Double-click the PATH variable under System Variables.
  • Click New, and add the directory where pip is installed, e.g. C:\Python33\Scripts\ and select OK.

Step 3: Verify

  • Open the command prompt and type the following command to verify the PIP installation:
pip --version

How to Upgrade Pip On Windows

pip can be upgraded using the following command:

python -m pip install -U pip

How to Downgrad PIP on Windows

It may happen sometimes that your current pip version is not supporting your current version of python or machine.

To fix that, you can downgrade your pip version with the help of Python pip install command and the following command.

Note: You can mention the version you want to install

python -m pip install pip==17.0

If you followed these steps, you will not face any issues while installing pip on windows. We have also discussed methods to upgrade or downgrade pip version in case you face any issues.

Managing Python Packages with PIP

Once PIP is installed, you can use it to manage Python packages. Here are some common commands:

  • Install a Package: To install a package, use:
    pip install package_name
  • Uninstall a Package: To remove a package, use:
    pip uninstall package_name
  • List Installed Packages: To see all installed packages, use:
    pip list
  • Show Package Information: To get detailed information about a package, use:
    pip show package_name
  • Search for Packages: To search for packages in the Python Package Index (PyPI), use:
    pip search package_name

Troubleshooting Tips

1. Python Not Recognized

Always ensure that Python is added to the PATH during the installation. In case, if it’s not, you can modify the PATH manually.

2. Permission Errors

Try running the Command Prompt as an administrator access.

3. SSL Errors

Ensure that te date and time is correct of your system (as SSL certificates usually relies on actual system clocks.)

Also Read

  • How to install PIP in Linux?
  • How to install pip in macOS?
  • Download and install pip Latest Version

Conclusion

By following this guide, you can successfully download, install, upgrade, downgrade, and manage PIP on Windows seamlessly. With PIP installed in your system, you can easily manage to Python packages and enhance your Python development environment. Whether you’re a beginner or an experienced developer, understanding how to work with PIP is essential for efficient Python programming.

Pip is a powerful package management system for Python that allows you to install and manage software packages written in Python. Having pip available in your Command Prompt is crucial for developers and data scientists who rely on Python libraries to build applications and analyze data. If you are using Windows 11 and find that pip is not recognized as a command, one of the first steps is to ensure that it’s added to your system’s PATH environment variable.

This article provides you with a comprehensive guide on how to add pip to the PATH on Windows 11. It covers everything from verifying your existing Python and pip installation to checking if they are added to the PATH. Additionally, we provide step-by-step instructions for modifying the environment variables if they are not already configured correctly.

Step 1: Verify Your Python and Pip Installation

Before we dive into adding pip to the PATH, it’s essential to verify if Python and pip are already installed on your system.

Check Python Installation

  1. Open the Start menu and type cmd to open Command Prompt.
  2. Type the following command and hit Enter:

    python --version

This command should return the version of Python installed on your computer. If it doesn’t, you may need to download and install Python from the official Python website.

Check Pip Installation

Similarly, check if pip is installed:

  1. In the Command Prompt, type:

    pip --version

If pip is installed, this command will display its version. If you receive an error message stating that pip is not recognized, proceed to the next section to address this.

Step 2: Install Python and Pip (if not installed)

If you found that either Python or pip is not installed, you can easily install them following these steps:

Downloading and Installing Python

  1. Visit the official Python website.
  2. Click on the «Download Python X.X.X» button, where X.X.X is the latest version.
  3. Once the installer is downloaded, run it. Important: Check the option that says «Add Python to PATH» before clicking on «Install Now».
  4. Follow the on-screen instructions to complete the installation.

This process will install both Python and pip since pip comes packaged with Python versions 3.4 and above.

Step 3: Find Installation Path

After installing Python, you should identify where it was installed on your machine. By default, Python is usually installed in one of these locations:

  • C:Users\AppDataLocalProgramsPythonPythonX.X
  • C:PythonX.X

Here, ` is your actual Windows username, andX.Xcorresponds to the version number. Within this directory, you should find theScriptsfolder which contains thepip.exe` executable.

Step 4: Add Pip to the PATH Environment Variable

Now that we know where Python and pip are installed, the next step is to add the Scripts directory to the system’s PATH environment variable. Here’s how you can do that:

Method 1: Using System Properties

  1. Open System Properties:

    • Right-click on the Start button and select System.
    • In the new window, click on About on the left sidebar.
    • Scroll down and click on Advanced system settings.
  2. Environment Variables:

    • In the System Properties window, click on the Environment Variables… button.
  3. Edit the Path Variable:

    • In the Environment Variables window, find the System variables section.
    • Scroll down to find the variable named Path and select it, then click on Edit….
  4. Add New Path:

    • In the Edit Environment Variable window, click on New.
    • Paste the path to the Python Scripts directory. This is typically something like:
    C:Users\AppDataLocalProgramsPythonPythonX.XScripts

    If you also want to ensure the main Python directory is included, you might also want to add:

    C:Users\AppDataLocalProgramsPythonPythonX.X
  5. Confirm Changes:

    • Click OK on all dialog boxes to close them.
    • You have now successfully added pip to your PATH.

Method 2: Using Command Line

Alternatively, if you prefer to do this via the Command Prompt, follow these steps:

  1. Open Command Prompt as an administrator. Right-click the Start button and select Windows Terminal (Admin) or Command Prompt (Admin).

  2. Use the following command to add pip to the PATH. Make sure to replace ` andX.X` with the appropriate values:

    setx PATH "%PATH%;C:Users\AppDataLocalProgramsPythonPythonX.XScripts"
  3. After running this command, you’ll need to restart the Command Prompt for changes to take effect.

Step 5: Verifying the Configuration

After adding pip to your PATH, it’s crucial to verify that everything is correctly set up. Open a new Command Prompt window and type:

pip --version

You should see the version of pip displayed without any error messages. If it does, congratulations! You have successfully added pip to your PATH in Windows 11.

Step 6: Troubleshooting Common Issues

Even after following the above steps, you may encounter problems. Here are some common issues and their quick fixes:

  • Pip not recognized after installation: Ensure that the installation paths are correct and added to the PATH variable. If not, recheck the installation paths and make necessary adjustments.

  • Command Prompt Admin Rights: Some commands may require administrator rights. To ensure you can run all commands smoothly, it’s advisable to open the Command Prompt with administrator permissions.

  • Reboot Your Computer: In some cases, changes might not immediately reflect until you restart your computer.

Step 7: Alternative Methods to Install Pip

If you’re not able to install pip using the conventional methods detailed above, there are alternative methods you can adopt:

Using the get-pip.py Script

  1. First, download the get-pip.py script from the official website. You can use a browser or use a command in Command Prompt to fetch the file:

    curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
  2. Next, run the script using Python:

    python get-pip.py

This method will install pip directly without needing to worry about existing installations.

Conclusion

In this comprehensive guide, we have covered everything from verifying Python and pip installations to adding pip to the PATH in Windows 11. Adding pip to your PATH makes it far easier to manage Python installations and libraries, ultimately enhancing your Python development experience.

Should you encounter any issues during installation, refer to the troubleshooting section above, and don’t hesitate to consult the extensive online resources and communities dedicated to Python and its ecosystem. Happy coding!

Recently, we wrote a detailed tutorial on how to build your own AI chatbot with ChatGPT API. And for that project, we used Python and Pip to run several essential libraries. So if you are also getting started with Python for a project, make sure to install Pip on your Windows PC. You will be able to download many of the dependencies and libraries in a few seconds. On that note, let’s go ahead and learn how to install Pip on Windows 11 and 10.

What is Pip?

How to Install Pip on Windows

Pip is the package manager for Python. In simple terms, it basically allows you to install and manage millions of Python packages and libraries from the command line. It connects to the Python Package Index (PyPI) repository where you can find thousands of projects, apps, software development kits, clients, and more. If you are developing a project, and if you need some dependencies which are not part of the standard Python distribution, Pip can add them for you effortlessly. Simply put, Pip is an integral part of Python and to get started, you must install both of them.

Check If Pip Is Already Installed on Windows

If you have installed Python, you may already have Pip installed on your system. So before you move to the installation steps, let’s check if Pip is already installed on Windows or not.

1. Open Command Prompt or Windows Terminal. After that, run the below command. If you get the Pip version as the output, it means Pip is already installed on your PC. You can scroll down and learn how to upgrade Pip to the latest version on Windows.

pip --version
How to Install Pip on Windows

2. In case, you get errors like “Command not found” or “‘Pip’ is not recognized as an internal or external command, operable program or batch file.”, it means that Pip is not properly installed on your PC. Follow the below steps to install Pip and configure its path as well.

How to Install Pip on Windows

Install Pip with Python

To install Pip on Windows, you need to install Python only. When you install Python using the desktop setup file, Pip is also sideloaded on Windows. Here is how you can set up Pip on Windows.

1. First and foremost, move to this link and download the latest version of Python for Windows.

How to Install Pip on Windows

2. After that, double-click on the setup file. Once the installer appears, make sure to enable the checkbox next to “Add Python.exe to PATH“.

Install Pip on Windows 11 and 10 (2023)

2. After that, click on “Customize installation” and make sure “pip” is enabled along with other options. Click on “Next” and then “Install”.

Install Pip on Windows 11 and 10 (2023)

3. Now, Python along with Pip, both will get installed on your Windows PC.

Install Pip on Windows 11 and 10 (2023)

Install Pip via Command Line

You can also manually install Pip on Windows from the command line either using CMD or Windows Terminal. Follow the steps below.

1. Right-click on this link and then choose “Save link as…”.

Install Pip on Windows From Command Line

2. Now, save it as “get-pip.py” file in the “Downloads” folder.

Install Pip on Windows From Command Line

3. Next, right-click on the “get-pip.py” file and choose “Copy as path”.

Install Pip on Windows From Command Line

4. Finally, open the Terminal and execute it in the below fashion. Enter python, add a space, and then paste the path. After that, hit Enter and Pip will be installed on your Windows 11/10 computer.

python "C:\Users\mearj\Downloads\get-pip.py"
Install Pip on Windows From Command Line

5. Apart from that, you can also run this command to download and install Pip on a Windows PC using the “ensurepip” module.

python -m ensurepip --upgrade
Install Pip on Windows From Command Line

Verify Pip Installation

1. To check if everything went right, open Windows Terminal or Command Prompt and run the below commands. If the installation was successful, the first command will display the Python version, and the second command will show the Pip version currently installed on your PC.

python --version
pip --version
Install Pip on Windows 11 and 10 (2023)

2. You can also type the below command to find all the commands pip takes as an argument. If it returns a long list of command options, you are good to go.

python --help
pip --help

Upgrade or Downgrade Pip on Windows

1. After installation, run the below command in the Terminal to upgrade Pip to the latest version on Windows. Here’s what the syntax looks like:

python -m pip install -U pip
Upgrade or Downgrade Pip on Windows

2. In case you want to downgrade Pip to a specific version, run the below command:

python -m pip install pip==19.0
Upgrade or Downgrade Pip on Windows

How to Add Python and Pip to PATH on Windows 11 and 10

After installing and running the Python or Pip command on Windows if you get errors such as “Pip is not recognized as an internal or external command,” or “Python is not recognized as an internal or external command,” or simply “Python not found”, do not worry. It means that Python or Pip may have been installed on your Windows PC, but their paths have not been configured correctly. We need to add their directories as a global Windows environment variable. Here is how to do it.

1. First of all, press “Windows + R” to open the Run prompt and paste the below path, and hit Enter.

%localappdata%\Programs\Python

2. After that, open another “Python3XX” folder. Now, copy the whole path from the address bar. This is Python’s path you need to add as an environment variable.

Fix the "Python is not recognized as an internal or external command" Error on Windows

3. Next, move to the “Scripts” folder and click on the “Address bar”. Now, copy the whole path again. This is Pip’s path you need to add as an environment variable.

How to Add Pip to PATH on Windows 11

4. After you get paths for both Python and Pip, open the Run prompt again by pressing “Windows + R”. Here, type sysdm.cpl and hit Enter. This will directly open the Advanced System Settings.

5. Move to the “Advanced” tab, and click on “Environment Variables” at the bottom.

How to Add Pip to PATH on Windows 11

6. Next, under the “User variables for …” section, select “Path” and click on the “Edit…” button.

How to Add Pip to PATH on Windows 11

7. Here, click on “New” and add both the paths you copied above on the left side. Now, click on “OK”. Keep in mind, the paths will be different for each PC. This will add python and pip as global environment variables on your PC.

python and pip path environment variables

7. Finally, open Command Prompt or Windows Terminal and run a Python/ Pip command. For example – You can use the pip command to install the OpenAPI on your Windows PC, and it won’t display an error.

python --version
pip install openai

So this is how you can download and install Pip on Windows 11 or 10. I would suggest downloading the official installer from Python’s website and installing it to steer clear of any errors. It works for me 100% of the time. Anyway, that is all from us. If you want to learn how to install Python in Ubuntu Linux, head to our guide for more details. And to find the best Python learning courses, we have a curated list ready for you. Finally, if you have any questions, let us know in the comment section below.


pip is a package management tool for Python that allows you to install and manage software packages from the Python Package Index (PyPI). The name pip originated as an acronym for Pip Installs Packages.

Most modern Python versions include pip by default. However, if it is missing, you can install it manually.

This guide will explain how to check if pip is installed, install it using two different methods, and upgrade or configure it on Windows.

draft - How to Install pip on Windows

Prerequisites

  • A Windows system.
  • Access to Command Prompt or PowerShell.
  • Python installed and added to PATH.

Note: Python is usually preinstalled on Windows. If not, the easiest method to get it is with Windows Package Manager. To install Python with winget, run: winget install Python.Python.

Check if pip Is Installed on Windows 

Python’s latest versions include pip, but some installations may not. Before installing pip on Windows, check if the system already has it.

Launch the command prompt and type the following command:

pip --version
pip not installed on windows

If pip is installed, the output displays the installed version. In case the system responds with an error message like the one above, follow one of the methods in this tutorial to install it.

Method 1: Install pip on Windows Using ensurepip

The ensurepip module is built into Python and can install pip if it’s missing. It’s useful in environments where pip was not included by default, such as embedded Python installations.

To install pip, run the following command:

python -m ensurepip --upgrade
python -m ensurepip --upgrade cmd output

After the installation completes, verify the pip installation with:

pip --version
pip --version cmd output

Method 2: Install pip on Windows Using get-pip.py

To install pip using this method, download the get-pip.py script using curl, then run it. Follow the steps below to install pip using this method.

Step 1: Download pip get-pip.py

Download the get-pip.py script with the following command:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py cmd output

Note: To check if the link in the command is up to date, visit the official site for get-pip.py. If you can access the file directly and it doesn’t print any errors, the link is still valid.

Step 2: Install pip on Windows

If you used the get-pip.py script to download pip, run the following Python command to install it:

python get-pip.py
python get-pip.py cmd output

Note: In some cases, get-pip.py outputs the installation location. If this happens, note the PATH to use when adding pip to your system’s PATH variable.

Step 3: Verify Installation

To test whether the installation was successful, type the following command:

pip --version
cmd output for pip --version

Step 4: Add pip to PATH

To run pip from any location and as a standalone command, add it to Windows environment variables.

Before modifying environment variables, check whether pip is already in your system’s PATH. Run this command:

where pip
where pip cmd output

If the command returns a valid PATH, skip this step. If the command cannot find the PATH, it returns the error:

where pip cmd output no path

Follow these steps to add pip manually:

1. Locate the pip installation directory, which is, by default, in the Scripts subdirectory of your Python installation. A typical path is:

C:\Users\[YourUsername]\AppData\Local\Programs\Python\PythonXX\Scripts

Replace [YourUsername] with your actual Windows username and PythonXX with the Python version.

In this tutorial, the path is:

C:\Users\PC\AppData\Local\Programs\Python\Python313\Scripts

Note it because you will need it in the coming steps.

2. Open the Start menu, search for Environment Variables, and press Enter.

Edit the environment variables

3. Click the Environment Variables button.

Click the Environment Variables button.

4. Double-click the Path variable to edit it.

Double-click the Path variable to edit it.

Note: Modify User variables for a single user or System variables to apply changes for all users.

5. Select New and add the directory where pip is installed, which you located and noted earlier,

pip installation directory

6. Click OK to save the changes.

7. Open a new command prompt session and run the following command to test the changes:

pip help
pip help cmd output

If the command does not work, try using pip3 instead of pip. Alternatively, add the directory where Python is installed to PATH and repeat the process.

Step 5: Configuration

The configuration file for pip exists in several locations on the system, including global, user-specific, and site-specific paths.

The configuration provides insight into how pip is set up and helps find installation problems or unexpected behavior.

To see the current configuration settings, run:

pip config -v list
pip config -v list cmd output

The command shows the possible global, user, and site locations for the pip.ini configuration file. If you need to adjust pip’s behavior, edit the appropriate pip.ini file based on these locations.

Upgrade or Downgrade pip on Windows 

New versions of pip are released occasionally. These updates improve functionality or are necessary for security purposes.

To upgrade pip on Windows, run:

pip install --upgrade pip

Downgrading is necessary if a new version of pip starts performing badly. To downgrade pip to a prior version, specify the version you want.

Use the following syntax:

python -m pip install pip==[version_number]

Conclusion

This guide explained two ways to install pip on Windows and elaborated on how to add pip to PATH when necessary. Additionally, it showed how to upgrade or downgrade pip.

Next, check out our guide and learn how to install NumPy, a powerful Python library for numerical computing, using pip.

Was this article helpful?

YesNo

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Как разблокировать компьютер если забыл пароль на windows 10 без сброса настроек
  • Windows run perl script
  • Как управлять вентиляторами компьютера в windows 10
  • Восстановление системы windows 10 на ноутбуке asus
  • В семействе ос windows наведение указателя мыши на пункт меню с маленькой черной стрелкой