How to install pip on Windows and start Python development

Python’s pip is the command-line utility for installing PyPi-based libraries and frameworks. It also helps in aggregating them for reuse, so it’s an essential tool for every Python programmer.

But how can you install pip on Windows?

Do you need to install pip on Windows?

New versions of Python come with the pip package by default. But you will need to install the pip package from scratch if you are using a Python version older than 3.4, or older than 2.7.9 if you are on Python 2.

USE VIDEO OF THE DAY

But pip can always disappear. This may be due to a faulty Python installation or an explicit uninstallation, even in supported versions. And even if your version of Python comes with pip, you’ll want to update it from time to time.

Check PIP and Python version on Windows

Although the latest versions of Python include pip, you should first check the Python and pip versions on your PC before attempting to install.

To check your Python version via the terminal:

python 

Regardless of your Python version, you also want to check your pip version:


py -m pip 

A “pip command not found” result indicates a missing pip packet. You will need a fresh install if you see this.

But if the command returns a pip version, you probably only need an upgrade.

How to install pip on Windows

The easiest way to install pip on Windows is to update to the latest version of Python.

However, if pip disappears, you can get the pip source code from the get-pip.py bootstrap page.

Copy the entire pip source code from this page and paste it into a new Python file using your favorite code editor. Name this Python file get-pip.py.

Then open the command prompt in the folder containing this file. Now run the following command:

py get-pip.py

The above command will install the pip package on Python site-packagepip phone book.

To confirm pip installation, run the version check command:

py -m pip 

Once installed, you can start using it to install Python dependencies, just like you would when using the npm package for JavaScript.

However, keep in mind that pip dropped support for Python 2, so using this method of installing pip may fail in lower versions of Python.

If you continue to receive an installation error after running the get pip script, download and install the latest version of Python to get pip.

If you already have pip installed

As mentioned, you probably already have pip on your PC if you’re using a newer version of Python (3.4 and later). However, upgrading pip often helps to eliminate bugs and prevent future download dependency issues.

Run the following command to update the version of pip on your PC:

py -m pip install 

If the output of the above command says “Requirement already met”, pip is already up-to-date on your Windows OS.


Manage Python dependencies with pip

The pip package makes it easy to access Python libraries and frameworks. It also keeps track of all dependencies during development, so none are missing during deployment. For example, freezing pip dependencies in a text file is common practice for many Python projects.

Pip is one of the most important tools available to Python programmers, but there are many more, with a range of uses.

Comments are closed.