24

I tried to install pip and easy_install on my CentOS but could not find them.

How can I install them?

Also, I have two versions of Python, 2.4 and 2.7. How will pip make sure to link newly installed components with Python 2.7?

0

10 Answers 10

13

It was simple. The path of pip is:

/opt/python2.7/bin/pip

If it's not there then install using:

/opt/python2.7/bin/easy_install pip

and it will install it.

1
  • What if I want to use pip of python 3?
    – rosefun
    Commented Nov 21, 2020 at 6:20
13

Following the pip installer documentation, one can simply issue the following:

# install setup tools
curl https://bitbucket.org/pypa/setuptools/downloads/ez_setup.py | python -
# install pip
curl https://bootstrap.pypa.io/get-pip.py | python -
1
11

I couldnt follow from previous answers to get easy_install. I followed the other commands to install pip. (requires sudo privileges)

to install easy_install:

sudo yum install python-setuptools python-setuptools-devel

to install pip:

sudo easy_install pip

5

Any packages in the repos will be built for 2.4. You will need to install them from source with 2.7.

python2.7 setup.py install
2
  • I found easy_install in /opt/python2.7/bin/easy_install but could not find pip. where it will be located
    – Mirage
    Commented Jun 3, 2011 at 5:42
  • I don't know anything about virtenv . is pip only insytalled if i use virtenv. i read the document but could not found the path of pip where its binary file is
    – Mirage
    Commented Jun 3, 2011 at 6:38
5

I issued this command in CentOS 7 and it worked

curl https://bootstrap.pypa.io/get-pip.py | python -
0
1

I wanted to install the latest version of Amazon Web Services Client Tools (awscli). This was done on CentOS 64 minimal using the system python: Download the latest setuptools (version 1.16 can be found here)

sudo -s
cd /opt
tar xzf <setuptools.tar.gz>
cd setuptools<-1.1.6>
python ez_setup.py
easy_install pip

Now you can install whatever you like using pip. For example,

pip install awscli

This method was very quick, allowed me to keep the CentOS system python.

1

There seem to be many ways to install pip on CentOS, but the way that worked for me was your method.

sudo python2.7 /usr/local/bin/easy_install pip

I tried several other ways first. The most common I found was to use yum with the EPEL repository.

cd /tmp
wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
sudo rpm -ivh epel-release-5-4.noarch.rpm
sudo yum -y install python-pip

The yum install failed for me with the error, "No package python-pip available."

The Pip project documentation says to use the get-pip.py script, but that gave me errors as well.

1
  • This worked for me too, I have two version of python 2.6 and 2.7.3. So my command is something like python2.7 /usr/local/bin/easy_install-2.7 pip. Pip is then available as pip2.7. Note that I did an altinstall using the instructions here. zoomq.qiniudn.com/ZQScrapBook/ZqFLOSS/data/20130821150955/…
    – Mahesh
    Commented Jun 19, 2017 at 9:31
1

from http://www.cyberciti.biz/faq/debian-ubuntu-centos-rhel-linux-install-pipclient/ the Red Hat way, using the EPEL repository:

[root@paulvps tmp]# wget http://mirror-fpt-telecom.fpt.net/fedora/epel/6/i386/epel-release-6-8.noarch.rpm
--2013-12-31 13:49:12--  http://mirror-fpt-telecom.fpt.net/fedora/epel/6/i386/epel-release-6-8.noarch.rpm
Resolving mirror-fpt-telecom.fpt.net... 118.69.250.132
Connecting to mirror-fpt-telecom.fpt.net|118.69.250.132|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14540 (14K) [application/x-redhat-package-manager]
Saving to: “epel-release-6-8.noarch.rpm”

100%[======================================>] 14,540      2.66K/s   in 5.3s    

2013-12-31 13:49:18 (2.66 KB/s) - “epel-release-6-8.noarch.rpm” saved [14540/14540]

[root@paulvps tmp]# rpm -ivh epel-release-6-8.noarch.rpm
warning: epel-release-6-8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
   1:epel-release           ########################################### [100%]
[root@paulvps tmp]# yum install python-pip
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/metalink                                            |  13 kB     00:00     
 * PUIAS_6_core_Base: puias.math.ias.edu
 * PUIAS_6_core_Updates: puias.math.ias.edu
 * base: centos.sonn.com
 * epel: epel.mirror.freedomvoice.com
 * extras: centos.mirror.freedomvoice.com
 * rpmforge: mirror.webnx.com
 * updates: mirrors.tummy.com
epel                                                     | 4.2 kB     00:00     
epel/primary_db                                          | 5.8 MB     00:00     
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package python-pip.noarch 0:1.3.1-4.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package             Arch            Version                Repository     Size
================================================================================
Installing:
 python-pip          noarch          1.3.1-4.el6            epel          330 k

Transaction Summary
================================================================================
Install       1 Package(s)

Total download size: 330 k
Installed size: 1.0 M
Is this ok [y/N]: y
Downloading Packages:
python-pip-1.3.1-4.el6.noarch.rpm                        | 330 kB     00:00     
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Importing GPG key 0x0608B895:
 Userid : EPEL (6) <[email protected]>
 Package: epel-release-6-8.noarch (installed)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : python-pip-1.3.1-4.el6.noarch                                1/1 
  Verifying  : python-pip-1.3.1-4.el6.noarch                                1/1 

Installed:
  python-pip.noarch 0:1.3.1-4.el6                                               

Complete!

I was a little skeptical about the fpt.net site, which redirects to fpt.vn, but if nixCraft says it's OK, I'm hoping they're right.

0

pip python package manager can be installed using curl to get get-pip.py.

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

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

rpm -ivh epel-release-6-8.noarch.rpm

yum -y install python-pip

1
  • i do not get it Commented Jan 24, 2018 at 13:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .