• How to Install Pip on CentOS 7

This is a quick tutorial on installing Pip, a tool for installing and managing Python packages. There are two options for installing Pip. You can use Yum or cURL.

Option 1: Install Pip with Yum
Step 1: First we will install the EPEL repo.

As your server has an x86_64 Operating System architecture, we will use only epel repo package for x86_64 . Search epel repo package as per your Operating System architecture(EPEL URL)

wget -r --no-parent -A 'epel-release-*.rpm' http://dl.fedoraproject.org/pub/epel/7/x86_64/e/

rpm -Uvh dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-*.rpm

It will create two epel’s repo file inside /etc/yum.repos.d These are –

  1. epel.repo 2.epel-testing.repo
[root@localhost ~]# ls -l /etc/yum.repos.d/
total 28
-rw-r--r--. 1 root root 1612 Jul  4 07:00 CentOS-Base.repo
-rw-r--r--. 1 root root  640 Jul  4 07:00 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 1331 Jul  4 07:00 CentOS-Sources.repo
-rw-r--r--. 1 root root  156 Jul  4 07:00 CentOS-Vault.repo
-rw-r--r--. 1 root root  957 Sep  2 12:14 epel.repo
-rw-r--r--. 1 root root 1056 Sep  2 12:14 epel-testing.repo
[root@localhost ~]#

If you are running CentOS 6 install the following repo instead:

rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

An alternative method depending on your Linux version is to use Yum:

yum install epel-release

Step 2: Install python-pip and any required packages

yum -y install python-pip

Option 2: Install Pip with Curl and Python

You can use cURL and Python to download and install Pip.

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

python get-pip.py

View a list of helpful commands:

pip --help

Check the version of Pip that is installed:

pip -V

You should see an output similar to:

pip 1.3.1 from /usr/lib/python2.7/site-packages (python 2.7)

This article was last modified: May 30, 2019, 2:53 p.m.

0 Comments

Please log in to leave a comment.

Add or change tags.

A comma-separated list of tags.

Share

Hacker News

Top