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.
Prerequisites
- A maintained/supported version of CentOS or Rocky Linux.
- Administrative privileges.
- Command-line access.
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:
- Using the curl command and Python.
- Installing with YUM.
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
2. Install Pip using the command below:
sudo python get-pip.py
3. Verify the installation with:
pip -V
Your Pip version may vary, but the output format should be as in the image below:
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.
4. Update the repository information:
sudo yum –y update
5. Install Pip with the command below:
sudo yum install python-pip
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.
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.
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.