Product Reviews

How to Install pip on Windows and Begin Python Development

Python’s pip is the command-line utility for installing PyPi-based libraries and frameworks. It also helps aggregate 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?

Newer Python versions come with the pip package by default. But you’ll need to install the pip package from scratch if you use a Python version earlier than 3.4, or earlier than 2.7.9 if you’re on Python 2.

MAKEUSEOF VIDEO OF THE DAY

But pip can still go missing. This might be due to a faulty Python installation or explicit uninstallation, even in supported versions. And even if your Python version comes with pip, you’ll want to upgrade it occasionally.

Check the PIP and Python Version on Windows

While the latest Python versions include pip, you should first check the Python and pip versions on your PC before attempting installation.

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 package. You’ll need a fresh installation 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 goes missing, you can get the pip source code from the get-pip.py bootstrap page.

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

Next, open the command prompt to the folder containing that file. Now run the following command:

py get-pip.py

The above command will install the pip package to Python’s site-package\pip directory.

To confirm pip installation, run the version check command:

py -m pip 

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

However, keep in mind that pip has dropped support for Python 2. So using this pip installation method might fail in lower Python versions.

If you keep getting 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 use a newer Python version (3.4 and later). However, upgrading pip often helps to purge bugs and prevent future dependency download issues.

Run the following command to upgrade the pip version on your PC:

py -m pip install 

If the above command result says, “Requirement already satisfied,” 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 helps keep track of all dependencies during development, so none goes missing during deployment. For instance, pip-freezing dependencies into a text file is a common practice for many Python projects.

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

Related Articles

Leave a Reply

Your email address will not be published.

Back to top button