2011-06-03 05:33:27 +0000 2011-06-03 05:33:27 +0000
24
24

如何在CentOS上安装pip和easy_install?

我试图在我的CentOS上安装pipeasy_install,但找不到它们。

我如何安装它们?

另外,我有两个版本的Python,2.4和2.7。pip如何确保新安装的组件与Python 2.7链接?

答案 (10)

13
13
13
2011-06-03 07:34:10 +0000

这很简单。pip的路径是:

/opt/python2.7/bin/pip

如果它不在那里,那就用以下方法安装。

/opt/python2.7/bin/easy_install pip

就可以安装了。

13
13
13
2013-11-07 19:34:58 +0000

按照pip安装程序文档,可以简单地发布以下内容。

# 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 -
10
10
10
2015-06-05 20:50:56 +0000

我无法按照之前的答案来进行简单的安装。我按照其他命令来安装pip。(需要sudo权限)

安装 easy_install:

sudo yum install python-setuptools python-setuptools-devel

安装pip:

sudo easy_install pip .

5
5
5
2011-06-03 05:36:48 +0000

仓库中的任何包都是为2.4构建的。你将需要从源码中安装它们到2.7。

python2.7 setup.py install
5
5
5
2015-03-25 18:21:44 +0000

我在CentOS 7中发出这个命令,结果

curl https://bootstrap.pypa.io/get-pip.py | python -
```。
1
1
1
2013-12-31 13:53:16 +0000

http://www.cyberciti.biz/faq/debian-ubuntu-centos-rhel-linux-install-pipclient/ 红帽的方式,使用 EPEL 仓库。

[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) <epel@fedoraproject.org>
 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!

我对fpt.net网站有点怀疑,它重定向到fpt.vn,但如果nixCraft说没问题,我希望他们是对的。

1
1
1
2013-10-12 14:14:11 +0000

我想安装最新版本的亚马逊网络服务客户端工具(awscli)。这是在CentOS 64最小使用系统python完成的。下载最新的setuptools(版本1.16可以找到这里

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

现在你可以使用pip安装任何你喜欢的东西。例如,

pip install awscli

这个方法非常快,允许我保留CentOS系统的python。

1
1
1
2015-02-03 23:08:37 +0000

在CentOS上安装pip的方法似乎有很多,但对我来说有效的方法是你的方法

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

我先尝试了其他几种方法。我发现最常见的方法是使用yum与EPEL仓库.

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

我先试了几种其他方法。

0x1&

yum安装对我来说是失败的,出现了 “No package python-pip available "的错误。

Pip项目文档 说要使用get-pip.py脚本,但这也给我带来了错误。

0
0
0
2016-12-22 09:14:51 +0000

pip python包管理器可以用curl安装,得到get-pip.py

curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
python get-pip.py
```。
0
0
0
2018-01-24 11:17:27 +0000

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。