How to Install Python Pip on Windows


Updated on:

Pip, short for Pip Installs Packages, is a powerful package management system used to install and manage software packages in Python. It simplifies the process of downloading and installing Python libraries, making it an essential tool for developers and enthusiasts alike.

While Pip comes pre-installed with Python distributions from version 3.4 onwards, some Windows users may need to install it separately.

In this article, we will walk you through the step-by-step process of installing Pip on Windows, ensuring you have everything you need to get started with Python package management.

Install Python Pip

Why is Pip Important for Python Development

Pip simplifies the process of managing Python packages, making it essential for Python development. Without Pip, developers would need to manually download, extract, and install each library, along with its dependencies, which can be time-consuming and error-prone.

Pip automates these tasks, streamlining the development process and allowing developers to focus on writing code rather than managing dependencies.

Benefits of Using Pip

  • Easy installation: Pip simplifies the installation process by automatically resolving dependencies and fetching the required packages from PyPI.
  • Dependency management: Pip tracks and manages package dependencies, ensuring that the correct versions are installed to prevent compatibility issues.
  • Package discovery: Pip provides a vast repository of Python packages available on PyPI, making it easy to find and install libraries for various needs.
  • Package updates: Pip enables effortless package updates, allowing you to keep your libraries up to date with the latest bug fixes and features.
  • Virtual environment support: Pip seamlessly integrates with virtual environments, allowing for isolated and project-specific package installations.

Checking If Python is available

Before installing Pip, it is crucial to ensure that you have a working Python installation on your Windows system. Follow the steps below to verify your Python installation:

Verifying Python Installation

To check if Python is installed on your system, follow these steps:

  1. Open the command prompt by pressing “Win + R” and typing “cmd” in the Run dialog box.
  2. In the command prompt, type “python” and press Enter.
  3. If Python is installed, the Python version and the Python interactive shell will be displayed.

Checking Python Version

To check the Python version, follow these steps:

  1. Open the command prompt.
  2. Type “python –version” and press Enter.
  3. The installed Python version will be displayed.

Check If PIP is Already Installed

To check if pip is already installed on your system, you can follow these steps:

  1. Open a command prompt or terminal window.
  2. Type the command “pip –version” and press Enter
  3. If pip is installed, you will see the version number along with some additional information.
  4. If pip is not installed, you will likely see an error message indicating that the command is not recognized.

How to Install Pip Using the Get-Pip.py Script

To install Pip on Windows, you will need to use the Get-Pip.py script, which automates the installation process. Follow the steps below:

1.    Downloading the Get-Pip.py Script

2.  Opening a Command Prompt

3. Executing the Get-Pip.py Script:

  1. In the command prompt, type the following command python get-pip.py and press Enter
  2. The script will download and install the latest version of Pip on your system.

How to Verify Installation of pip

  1. To verify that pip is installed correctly, you can run the following command “pip –version”
  2. You should see the version number of pip displayed, confirming that it now installed on your Windows system.

How to Add Pip to Windows Environment Variables

Adding Pip to the system’s PATH variable allows you to access it from any directory. Follow these steps to configure the PATH variable:

  1. Open the Control Panel and navigate to System and Security > System.
  2. Click on “Advanced system settings” on the left-hand side.
  3. In the System Properties window, click on the “Environment Variables” button.
  4. In the Environment Variables window, select the “Path” variable under “System variables” and click “Edit.”
  5. Append the following path to the variable value, separating it from the previous entry with a semicolon (;):
  6. Click “OK” to save the changes.

Configuring Proxy Server (if required)

If you are behind a proxy server, you may need to configure Pip to work through it. Follow these steps:

  1. Open the command prompt.
  2. Set the HTTP and HTTPS proxy environment variables using the following commands:
    • set HTTP_PROXY=http://your_proxy_server:port
    • set HTTPS_PROXY=http://your_proxy_server:port
  3. Execute the Pip commands to install or update packages.

(Replace “your_proxy_server” and “port” with your proxy server address and port number.)

Changing the Default Installation Location

By default, Pip installs packages in the Python installation directory. If you want to change the default installation location, follow these steps:

  1. Create a directory where you want to install the packages.
  2. Open the command prompt.
  3. Set the PIP_TARGET environment variable to the path of the desired installation directory using the following command:
    • set PIP_TARGET=installation_directory_path
  4. Execute the Pip commands to install or update packages.

(Replace “installation_directory_path” with the path to your desired installation directory.)

How to Upgrade or Downgrade the Pip version

To upgrade or downgrade the Pip version on Windows, follow the steps below:

1. Open the command prompt:

  •    Press “Win + R” on your keyboard to open the Run dialog box.
  •    Type “cmd” and press Enter to open the command prompt.

2. Check the current Pip version:

  • In the command prompt, type the following command and press Enter: “` pip –version“`
  • The installed Pip version will displayed.

3. Upgrading Pip for Python on Windows:

  • To upgrade Pip to the latest version, use the following command:

“pip install –upgrade pip“`

  • Pip will download and install the latest version of itself.

4. Downgrading Pip Version on Windows:

  • If you want to downgrade the Pip version to a specific version, use the following command:     “`pip install pip==desired_version“`

     (Replace “desired_version” with the version number you want to install.)

  • Pip will download and install the specified version.

5. Verifying the Pip version:

  • After upgrading or downgrading Pip, you can verify the installed version by running the command: “`pip –version“`
  • The new Pip version will display.

NOTE: It’s important to note that upgrading or downgrading Pip may require administrative privileges. Therefore, it is recommended to run the command prompt as an administrator by right-clicking on the Command Prompt icon and selecting “Run as administrator.”

FAQs on Install Python Pip on Windows

Can I install Pip without an internet connection on Windows?

No, Pip requires an internet connection to download and install packages from the Python Package Index (PyPI) and other sources.

What should I do if I encounter issues while upgrading or downgrading Pip on Windows?

If you encounter issues, ensure you have a stable internet connection, check the PATH variable for Python and Pip, and run the command prompt as an administrator.

Can I install multiple versions of Pip on Windows?

Installing multiple versions of Pip is not necessary or recommended. It recommended to have the latest version installed.

Can I use Pip to install packages globally on Windows?

Yes, Pip can install packages globally on Windows, making them available to all Python projects on the system.

Is it necessary to upgrade Pip on Windows?

It is recommended to keep Pip up to date by upgrading it regularly to access the latest features, bug fixes, and security updates

Leave a Comment