我的设置:
apt-get install也可以工作
下面是我在此之前配置代理时所做的工作:
/etc/profile.d/proxy.sh:
export http_proxy="http://<my_proxy>:<my_port>"
export https_proxy="http://<my_proxy>:<my_port>"
export ftp_proxy="http://<my_proxy>:<my_port>"为了获得工作能力,修改了/etc/apt/apt.conf.d/01代理:
Acquire::http::Proxy “http://<my_proxy>:<my_port>"若要在使用sudo时保留env,请修改/etc/sudoers.d/代理:
Defaults env_keep += "http_proxy https_proxy ftp_proxy"我还在Settings->Network->NetWork中设置了HTTP/HTTPS/FTP代理设置,并单击“应用系统宽”。
问题是,当我尝试pip install (有或不带sudo)时,它失败了,出现了错误:
$ pip -vv install git-review
Downloading/unpacking git-review
Getting page http://pypi.python.org/simple/git-review
Could not fetch URL http://pypi.python.org/simple/git-review: <urlopen error [Errno -2] Name or service not known>
Will skip URL http://pypi.python.org/simple/git-review when looking for download links for git-review
Getting page http://pypi.python.org/simple/
Could not fetch URL http://pypi.python.org/simple/: <urlopen error [Errno -2] Name or service not known>
Will skip URL http://pypi.python.org/simple/ when looking for download links for git-review
Cannot fetch index base URL http://pypi.python.org/simple/
URLs to search for versions for git-review:
* http://pypi.python.org/simple/git-review/
Getting page http://pypi.python.org/simple/git-review/
Could not fetch URL http://pypi.python.org/simple/git-review/: <urlopen error [Errno -2] Name or service not known>
Will skip URL http://pypi.python.org/simple/git-review/ when looking for download links for git-review
Could not find any downloads that satisfy the requirement git-review
No distributions at all found for git-review
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 git-review我试过使用--代理选项(带有/不带=号的--proxy=http://<my_proxy>:<my_port>、带/不带引号的),但即使这样也会显示相同的错误。
我还尝试将. .pip/pip.conf设置为:
[global]
timeout = 60
proxy = http://<my_proxy>:<my_port>作为另一个数据点,如果有用的话,命令行中的nslookup对于公司intranet之外的域会失败,但是对内部的域有效。然而,如前所述,Firefox和apt-get似乎没有使用代理解决域名的问题。
有什么想法吗?谢谢!
发布于 2015-04-18 11:13:41
这是由pip中的一个bug引起的,这个问题早在2014年6月就被解决了
https://stackoverflow.com/questions/23699968
复制相似问题