DMCA.com Protection Status Trending Topics About Devops: Install Python PIP on CentOS7

Wednesday, 1 September 2021

Install Python PIP on CentOS7

 Python PIP is a package manager for Python, just like Yum is a package manager for CentOS 7 and RHEL 7.

In this article, I will show you how to install Python 2 PIP and Python 3 PIP on CentOS 7. Let’s get started.

Pre-requisites:

First update the package repository cache of yum package manager with the following command:

Volume 0%
 
$ sudo yum makecache

The yum package repository cache should be updated.

Python PIP is not available in the official package repository of CentOS 7. But it is available in the EPEL package repository. Before you can install Python PIP on CentOS 7, you must add EPEL repository to your CentOS 7.

To add EPEL package repository on CentOS 7, run the following command:

$ sudo yum install epel-release

Press ‘y’ and then press <Enter> to continue.

EPEL package repository should be added.

Now update the package repository cache of your CentOS 7 again with the following command:

$ sudo yum makecache

The package repository cache should be updated.

Now you’re ready to install Python PIP.

PIP is available for Python 2 and Python 3 in the EPEL repository. In this article, I will show you how to install Python 2 PIP and Python 3 PIP.

Installing Python 2 PIP:

In this section, I will show you how to install Python 2 PIP.

Run the following command to install Python 2 PIP:

$ sudo yum install python-pip

Press ‘y’ and then press <Enter> to continue.

Press ‘y’ and then press <Enter> to accept the GPG key.

Python 2 PIP should be installed.

You can run the following command to check whether Python 2 PIP is working.

$ pip -V

As you can see the version of PIP installed is PIP 8.1.2. By the time you read this, the version may change but don’t worry about it. It should work the same way.

Installing Python 3 PIP:

In this section I am going to show you how to install Python 3 PIP.

At the time of this writing, on EPEL repository of CentOS 7, Python 3.4 is available. By the time you read this article, the package version may change. If the package version changes, so will the package name. So I am not going to install any specific version of Python 3 PIP. I will show you how to search for it and install what is available when you read this article.

You can run the following command to search for a Python 3 PIP package:

$ sudo yum search pip | grep python3

As you can see from the marked section of the screenshot below, the package name of Python 3 PIP is python34-pip.

Now you can install Python 3 PIP with the following command:

$ sudo yum install python34-pip

Now press ‘y’ and then press <Enter> to continue.

Python 3 PIP should be installed.

Now you can check whether Python 3 PIP is working with the following command:

$ pip3 -V

No comments: