使用easy_install安装pip
我没有root权限,我想从头安装python。所以我下载了python源代码并编译了它。接下来我想安装pip
。但是,当我跑python get-pip.py
我得到这个错误:使用easy_install安装pip
ImportError: cannot import name HTTPSHandler
不具有root权限,我不能东西需要安装。所以我想也许我可以安装pip
与easy_install
,所以我去了并安装setuptools
其中有easy_install
。但是,当我运行easy_install pip
我得到这个错误:
Searching for pip
Reading https://pypi.python.org/simple/pip/
Download error on https://pypi.python.org/simple/pip/: unknown url type: https -- Some packages may not be found!
Couldn't find index page for 'pip' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
Download error on https://pypi.python.org/simple/: unknown url type: https -- Some packages may not be found!
No local packages or download links found for pip
error: Could not find suitable distribution for Requirement.parse('pip')
所以现在如何安装pip
?我真的很疯狂!
编辑:我不能使用virutalenv
try this to install pip : "easy_install-2.7 -U --user pip"
**another important info**
在Ubuntu,Debian或者Linux Mint的安装PIP:
$ sudo apt-get install python-pip
在Fedora安装PIP:
$ sudo yum install python-pip
在CentO上安装pip S,首先启用EPEL软件库,然后运行:
$ sudo yum install python-pip
要上的Archlinux安装PIP:
$ sudo pacman -S python-pip
我没有root访问权限! – 2014-10-09 14:17:38
你有没有运行这个命令? easy_install-2.7 -U --user pip – Priyank 2014-10-09 14:19:03
是的,我得到了同样的错误 – 2014-10-09 15:09:01
VIRTUALENV来救援!它带有pip,不需要root权限,并且允许你拥有不同的环境,每个环境都有自己的python,pip和模块副本。 The installation docs列出了几种安装方法,您希望最后一个名为“从本地使用源”。还请看看virtualenvwrapper,这只是一组使shell脚本更容易处理virtualenv的shell脚本。谷歌将为这两个产生足够的教程。
为什么消极的爱? – ErlVolton 2014-10-09 14:23:02
对于那些有没有根访问,这里是我如何解决这个问题。
下载Python(Gzipped源压缩包)。
解压并cd到Python源代码目录。
-
配置与 “--with-ensurepip =安装” 标志,例如,
./configure --prefix=[your-specified-dir] --with-zlib-dir=/usr/lib64 --with-ensurepip=install
使&使安装
现在你应该有一个工作,但过时的点子。要获取最新的点子,下载get-pip.py文件并运行蟒蛇get-pip.py
现在你应该有最新的点子。请享用。:)
'--with-ensurepip = install'就像魅力一样 – daemon12 2017-12-14 10:09:39
这不是准确地回答原来的问题,但如果你不幸尝试在centos6上安装pip
和easy_install
,我希望这有助于。
这用来工作,但现在失败,以下错误:
$ docker run -ti centos:6 bash -c 'yum install -y python-setuptools && easy_install pip'
...
Installed:
python-setuptools.noarch 0:0.6.10-3.el6
Complete!
Searching for pip
Reading http://pypi.python.org/simple/pip/
Couldn't find index page for 'pip' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
No local packages or download links found for pip
error: Could not find suitable distribution for Requirement.parse('pip')
我猜http://pypi.python.org开始严肃对待需要https
。 如果你使这个小黑客然后easy_install pip
工作。 sed --in-place 's#http://pypi.python.org#https://pypi.python.org#g' /usr/lib/python2.6/site-packages/setuptools/command/easy_install.py
为什么你不能使用的virtualenv – ErlVolton 2014-10-09 14:23:52
检查这个帖子.. http://stackoverflow.com/questions/19926683/issue-with-easy-install-2-7 – 2016-04-25 21:53:34