How to Install PIP in Python?

Learn via video course
FREE
View all courses
Python Course for Beginners With Certification: Mastering the Essentials
Python Course for Beginners With Certification: Mastering the Essentials
by Rahul Janghu
1000
4.90
Start Learning
Python Course for Beginners With Certification: Mastering the Essentials
Python Course for Beginners With Certification: Mastering the Essentials
by Rahul Janghu
1000
4.90
Start Learning
Topics Covered

Package Installer for Python which is known as PIP is the standard package manager for python. Ian Bicking created a tool to manage and install libraries in python called pyinstall in 20082008. The pyinstall was renamed to PIP Package Management System in 20112011 when Ian handed over the maintenance of pyinstall to Python Packaging Authority (PyPA).

PIP is the most popular and most used package manager for Python. PIP is a command line tool to install, update and remove libraries in Python.

PIP is shipped along with the Python installer itself. But if you missed it, we'll help you install pip in an existing python installation.

Getting Started

Firstly we will verify if a python installation is already present. To do this in windows, run the following command in powershell(or command prompt).

The above is the python shell. It shows that the python installation is available on your system.

Instead, if you are shown an error saying

It means python is not properly installed on your system, or you need to update $PATH environment variable with the location of python binaries. Follow the tutorial Install Python on Windows to resolve the above error.

Transform Your Career

Choose from our industry-leading programs designed for career success

NSDC Certified

Modern Software and AI Engineering Program

Master full-stack development with AI integration

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Modern Data Science and ML with specialisation in AI

Advanced data science techniques with AI specialization

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Advanced AIML with Specialisation in Agentic AI

Deep dive into AIML with focus on Agentic systems

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

DevOps, Cloud & AI Platform Engineering

Build and manage AI-powered cloud infrastructure

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

AI Engineering Advanced Certification by IIT-Roorkee

Premier AI engineering certification from IIT-Roorkee

3 MonthsDuration
AI-LedCurriculum
Career SupportSupport
Program highlights
Go to Program

Installing pip in Python

To install pip in python, we can follow either of the following two methods:

  1. Installing PIP using theensurepipmodule or
  2. Installing PIP usingget-pip.py

Installing PIP Usingensurepip

Python has a pre-installed module named ensurepip. This module helps us to install pip and update it for any python installation or a virtual environmeint.

To install pip using this module run the following command in PowerShell or Command Prompt.

The advantage of using ensurepip module is that the installation of pip does not require us to have an internet connection. The ensurepip module itself contains all the components needed to install pip.

To always install the latest version of pip using ensurepip, we may pass --upgrade option to the above command.

Another method of installing pip that requires an active internet connection is by using get-pip.py.

Free Courses by top Scaler instructors
Python Course for Beginners With Certification: Mastering the Essentials
Java Course - Mastering the Fundamentals
DBMS Course - Master the Fundamentals and Advanced Concepts
JavaScript Course With Certification: Unlocking the Power of JavaScript
C++ Course: Learn the Essentials
Python and SQL for Data Science
Python Course for Beginners With Certification: Mastering the Essentials
Java Course - Mastering the Fundamentals
DBMS Course - Master the Fundamentals and Advanced Concepts
JavaScript Course With Certification: Unlocking the Power of JavaScript
C++ Course: Learn the Essentials
Python and SQL for Data Science

Installing PIP Using get-pip.py

This method uses a python script called get-pip.py to install pip in python. This script is officially published by PyPA, which lets one download pip and install it in any python installation or virtual environment.

Follow the below steps to start installing pip in python:

Scaler Placement Report and Statistics

₹23L
AVG CTC
SCALER PLACEMENT PROOF

Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching ₹23L.

11,000+placements
650+companies
Verified data
Hiring Partners:
GoogleGoogleAmazonAmazonMicrosoftMicrosoftFlipkartFlipkartAdobeAdobe1200+ more

Step 1: Downloadingget-pip.pyFile

This method uses a python script called get-pip.py to install pip in python. This script is officially published by PyPA, enabling one to download pip and install it in any python installation or virtual environment.

Make sure you have an active internet connection. Then visit the URL https://bootstrap.pypa.io/get-pip.py" using any browser to download the get-pip.py file.

You may run the following commands in PowerShell to download the file using the command line.

After using either of the two ways to download the get-pip.py file, open the directory where the file is located in PowerShell.

Step 2: Executingget-pip.pyto install pip

As we have already verified the python installation. We will use the python command to execute the script get-pip.py.

Turn Learning into Career Growth

1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary
1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary

Step 3: Verifying the pip installation

The above command will display the error, if any, in the output. On successful installation message saying Successfully installed pip-XX.X.X will appear at the end.

Since humans are hungry for perfection, we can run the below command to ensure the pip has been installed properly.

Output with the installed version number of pip will appear on the command line.

Upgrading PIP

There can be a situation where an existing installation of pip needs to be updated. Having the latest version of pip ensures that all the repositories of python libraries are updated before we fetch and install any new library.

There is no auto-updating feature available for pip(or even python), so we have to trigger the update of pip manually.

Run the command below in PowerShell to upgrade an existing installation of pip.

A success message is given at the end of the upgrade.

Note: That upgrading pip also requires an active internet connection.

Learn More:

Here are a few references that will help you to get more insights regarding pip.

Conclusion

In this tutorial, we have understood the following:

  • How to install pip in python on windows
  • Using the ensurepip module to install pip
  • ensurepip can work without an active internet connection
  • Using get-pip.py script to install pip in python
  • get-pip.py method needs you to have an active internet connection to work
  • pip lacks the auto-update feature and had to be updated manually