How to Install Pip in Python

Tutorial Playlist

PIP is Python’s package manager, which simplifies the installation, upgrade, and management of software packages. It enables users to install third-party libraries and dependencies with ease. Understanding how to install and utilize PIP is critical for Python developers. In this post, we’ll look at how to install, verify, and use PIP properly.

Table of Contents

How to Install PIP in Python

PIP is installed by default in Python versions 3.4 and higher. However, if you are using an older version or need to reinstall it, follow the instructions in this article.

Checking if PIP is Installed

Before installing PIP, make sure it’s already installed on your machine by typing the following line in the terminal or command prompt:

pip --version

If PIP is installed, this command will show the installed version. If not, proceed with the installation instructions listed below.

pip 24.0 from C:\Users\Intellipaat\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip (python 3.12)

How to Install PIP in Python on Windows

If PIP is not pre-installed, follow these steps:

Step 1: Download PIP get-pip.py

Download the get-pip.py file first, then install PIP. Enter the following cURL command at the command prompt:

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

Wait for the download to complete before moving on to the next step.

Step 2: Run the Installation Script

Go to the location where you extracted get-pip.py and perform the following line in the command prompt:

python get-pip.py

This will install or upgrade PIP on your system.

Step 3: Verify Installation

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

python -m pip help

Step 4: Add Pip to Path

To run PIP from any location and as a standalone command, add it to Windows environment variables. Doing so resolves the “not on Path” error.

To add PIP to Path, follow these steps:

    1. Navigate to the Start menu, search for Environment Variables, and hit Enter.
    2. Select the Environment Variables button.
    3. Double-click the Path variable to edit it.
    4. Choose New and enter the directory where PIP is installed.
    5. Click OK to save your changes.
    6. To test the modifications, open a new command prompt session and use the following command:
pip help

If the command does not work, use pip3 instead of pip. Alternatively, add the Python installation location to the path and repeat the process.

How to use PIP in Python

PIP is a powerful package manager that allows you to easily install, update, and manage Python libraries.

1. Downloading a Package Using PIP

To install a package using PIP, use the following command:

pip install scrapy

This installs the scrapy package. Replace scrapy with the name of the package you want to install.

2. Removing a Package Using PIP

To uninstall a package, use:

pip uninstall scrapy

PIP will prompt for confirmation before removing the package.

3. Listing Installed Packages

To view a list of all installed packages, run:

pip list

4. Searching for Packages

To search for a specific package, use:

pip search scrapy

This command retrieves relevant package details from the Python Package Index (PyPI).

Upgrading PIP in Python

PIP updates offer access to the most recent features and security patches. To upgrade PIP, do the following command.

pip install --upgrade pip

This command downloads and installs the latest version of PIP.

Conclusion

PIP is a crucial tool for effectively managing Python packages. It simplifies Python development by automating everything from library installation to dependency management. Knowing how to install, utilize, and upgrade PIP is critical for all Python developers. Want to improve your Python skills? Join our Python Course Today!

Our Python Courses Duration and Fees

Program Name
Start Date
Fees
Cohort starts on 29th Mar 2025
₹20,007

About the Author

Technical Research Analyst - Full Stack Development

Kislay is a Technical Research Analyst and Full Stack Developer with expertise in crafting Mobile applications from inception to deployment. Proficient in Android development, IOS development, HTML, CSS, JavaScript, React, Angular, MySQL, and MongoDB, he’s committed to enhancing user experiences through intuitive websites and advanced mobile applications.