Ubuntu 12.04上pip无法工作
我的系统是ubuntu 12.04,使用的是python 2.7。这台机器在公司防火墙后面。
我已经设置好了需要的代理,一切都运行得很好(上网、下载、浏览网页、使用sudo apt-get等都没问题)。
但是,pip安装却不成功。
比如说,如果我尝试安装celery,在pip的日志里我看到以下错误:
/usr/bin/pip run on Thu Mar 20 15:32:15 2014
Downloading/unpacking celery
Getting page http://pypi.python.org/simple/celery
Could not fetch URL http://pypi.python.org/simple/celery: timed out
Will skip URL http://pypi.python.org/simple/celery when looking for download links for celery
Getting page http://pypi.python.org/simple/
Could not fetch URL http://pypi.python.org/simple/: timed out
Will skip URL http://pypi.python.org/simple/ when looking for download links for celery
Cannot fetch index base URL http://pypi.python.org/simple/
URLs to search for versions for celery:
* http://pypi.python.org/simple/celery/
Getting page http://pypi.python.org/simple/celery/
Could not fetch URL http://pypi.python.org/simple/celery/: timed out
Will skip URL http://pypi.python.org/simple/celery/ when looking for download links for celery
Could not find any downloads that satisfy the requirement celery
No distributions at all found for celery
Exception information:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 126, in main
self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 223, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 948, in prepare_files
url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 152, in find_requirement
raise DistributionNotFound('No distributions at all found for %s' % req)
DistributionNotFound: No distributions at all found for celery
1 个回答
0
PIP不支持需要身份验证的代理。你有没有这样的代理?如果可以的话,试着把它关掉。
如果关不掉,你可以尝试安装一个叫CNTLM的代理认证服务。
安装完CNTLM后,你可以这样运行pip:
export HTTP_PROXY=http://127.0.0.1:3128
sudo -E pip install some_package
这里有一个详细的例子,讲的是用Ruby gems的情况,链接在这里: http://annelagang.blogspot.com/2012/11/installing-gems-in-ubuntu-1204-using.html