使用easy_install的安装PIP

问题描述 投票:23回答:6

我没有root访问权限,我想从头开始安装蟒蛇。于是我下载了Python源代码和编译它。接下来,我想安装pip。但是,当我跑python get-pip.py我得到这个错误:

ImportError: cannot import name HTTPSHandler

没有root权限,我无法安装的东西需要。所以我想也许我可以安装pipeasy_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

python pip easy-install
6个回答
17
投票

尝试使用此方法安装PIP: “easy_install的-2.7-U --user点子”

**another important info** 

在Ubuntu,Debian或者Linux Mint的安装PIP:

$ sudo apt-get install python-pip

在Fedora安装PIP:

$ sudo yum install python-pip

要安装在CentOS点子,首先启用EPEL软件库,然后运行:

$ sudo yum install python-pip

要在安装的Archlinux PIP:

$ sudo pacman -S python-pip

8
投票

这不正是回答原来的问题,但如果你不幸足以试图在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


4
投票

对于那些谁没有root访问权限,这里是我是如何解决这个问题。

  1. 下载python(Gzip压缩源码包)。
  2. 解压缩和CD到Python源目录。
  3. 与配置“--with-ensurepip =安装”标志,例如 ./configure --prefix=[your-specified-dir] --with-zlib-dir=/usr/lib64 --with-ensurepip=install
  4. 让&make install的
  5. 现在你应该有一个工作,但过时的点子。要获取最新的点子,下载get-pip.py文件并运行python get-pip.py

现在你应该有最新的点子。请享用。 :)


0
投票

VIRTUALENV来救援!它配备了PIP,不需要root访问权限,并允许你有每一个都有自己的蟒蛇,画中画和模块复制不同的环境。 The installation docs列出了几种安装方式,你希望是最后一个被称为“从源代码在本地使用”。此外,也请看一看virtualenvwrapper,这仅仅是一个集,因此与virtualenv中变得更容易shell脚本。谷歌将产生这两种充足的教程。


0
投票

PIP安装在我的情况下,你的Python版本关心确认读音字使用python3所以我用下面的命令和它的作品。让我们来试试这个

我使用的MacOS

$ python3 get-pip.py


0
投票

给了我很多的麻烦太多,但这个工作对我来说:

python3 get-pip.py

© www.soinside.com 2019 - 2024. All rights reserved.