首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Python安装(使用代理)无法解析VPN后面VM中的服务器。

Python安装(使用代理)无法解析VPN后面VM中的服务器。
EN

Stack Overflow用户
提问于 2014-05-16 16:11:55
回答 1查看 9.1K关注 0票数 5

我的设置:

  • 企业网络上的Windows 7 64位主机
  • Ubuntu12.04 64位VirtualBox来宾
    • 用VirtualBox桥接适配器配置的Ubuntu来宾
    • 代理设置确认工作:火狐可以访问企业内部网网站以及互联网,apt-get install也可以工作

下面是我在此之前配置代理时所做的工作:

/etc/profile.d/proxy.sh:

代码语言:javascript
复制
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代理:

代码语言:javascript
复制
Acquire::http::Proxy “http://<my_proxy>:<my_port>"

若要在使用sudo时保留env,请修改/etc/sudoers.d/代理:

代码语言:javascript
复制
Defaults env_keep += "http_proxy https_proxy ftp_proxy"

我还在Settings->Network->NetWork中设置了HTTP/HTTPS/FTP代理设置,并单击“应用系统宽”。

问题是,当我尝试pip install (有或不带sudo)时,它失败了,出现了错误:

代码语言:javascript
复制
$ 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设置为:

代码语言:javascript
复制
[global]
timeout = 60
proxy = http://<my_proxy>:<my_port>

作为另一个数据点,如果有用的话,命令行中的nslookup对于公司intranet之外的域会失败,但是对内部的域有效。然而,如前所述,Firefox和apt-get似乎没有使用代理解决域名的问题。

有什么想法吗?谢谢!

EN

回答 1

Stack Overflow用户

发布于 2015-04-18 11:13:41

这是由pip中的一个bug引起的,这个问题早在2014年6月就被解决了

https://github.com/pypa/pip/issues/1104

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23699968

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档