How to Install Pip on CentOS and Rocky Linux

November 5, 2024

Introduction

Pip Installs Packages (Pip) is a package management system that simplifies the deployment of software written in Python. All packages listed in the Python Package Index (PyPI) can be installed using Pip.

In this tutorial, learn how to install Pip on CentOS and Rocky Linux.

Tutorial on how to install Pip on CentOS and Rocky Linux.

Prerequisites

Installing Pip on CentOS and Rocky Linux

Installing Pip on CentOS and Rocky Linux is a simple process that can be performed using one of the two methods:

Both methods are explained in the sections below.

Install Pip on CentOS and Rocky Linux with curl and Python

Pip can be installed using a Python script that is available online. To do so, proceed with the steps below:

1. Download the package from the official repository using the curl command:

curl -O https://bootstrap.pypa.io/get-pip.py
Downloading the Pip Python script with the curl command.

2. Install Pip using the command below:

sudo python get-pip.py
Running the Pip Python script.

3. Verify the installation with:

pip -V

Your Pip version may vary, but the output format should be as in the image below:

Verify you have successfully installed Pip on CentOS.

Install Pip on CentOS and Rocky Linux with YUM

By default, Pip is part of the Extra Packages for Enterprise Linux (EPEL) repository. Follow the steps below to use YUM to install Pip on CentOS and Rocky Linux:

1. Run the command below to enable the EPEL repository:

sudo yum install epel-release

2. Confirm the installation by entering y and waiting for the system to complete the task.

Adding the epel-release repository.

4. Update the repository information:

sudo yum –y update

5. Install Pip with the command below:

sudo yum install python-pip
Installing Pip with Yum.

6. Verify the installation with:

pip –V

Note: To see the list of all the pip commands type: pip --help. For examples of how to use them, take a look at some of the essential Pip commands explained.

How to Uninstall Pip on CentOS and Rocky Linux

Depending on how you installed Pip, there are two ways to remove the software from your system.

If you used curl (the first option), you can delete Pip by running:

pip uninstall pip

Confirm you want to proceed by typing y. The output displays you successfully uninstalled Pip.

Output showing you have successfully uninstalled Pip from CentOS and Rocky Linux.

On the other hand, if you installed Pip from the EPEL repository, remove it with:

sudo yum remove python-pip

Press y to verify. You should see a message as in the example below.

Removing a repository version of Pip from CentOS or Rocky Linux.

Conclusion

If you applied the steps described in this article, you have a working installation of Pip on CentOS or Rocky Linux. Pip’s emphasis on code readability and ease of use make it the go-to solution for installing and managing Python software packages.

If you are a beginner in Python, learn how to Change the Working Directory in Python.

Was this article helpful?
YesNo
Marko Aleksic
Marko Aleksić is a Technical Writer at phoenixNAP. His innate curiosity regarding all things IT, combined with over a decade long background in writing, teaching and working in IT-related fields, led him to technical writing, where he has an opportunity to employ his skills and make technology less daunting to everyone.
Next you should read
How to Install Pip on CentOS 8
August 3, 2020

Pip is a standard package manager for Python which you can use to install additional packages that are not...
Read more
How to Get the Current Date and Time in Python
March 12, 2024

The article shows you how to create a basic Python script that displays the current date and time. Find out...
Read more
How To Upgrade or Update CentOS 7.0/7.1/7.2/7.3/7.4/7.5 to CentOS 7.6
April 5, 2019

CentOS 7.6 is a minor update and was published in December 2018. It includes various minor updates and...
Read more
How to Install Latest Version Of Python 3 on CentOS 7
March 12, 2019

Python is a popular, stable, and well-performing programming language. CentOS 7 uses Python 2.7.5, but as...
Read more