我的设置:
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/01proxy:
Acquire::http::Proxy “http://<my_proxy>:<my_port>"
要在使用sudo时保持env变量,修改后的/etc/sudoers.d/proxy:
Defaults env_keep += "http_proxy https_proxy ftp_proxy"
我还在设置 - >网络 - >网络代理中设置了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选项(--proxy=http://<my_proxy>:<my_port>
带/不带=符号,带/不带引号),但即便如此也显示相同的错误。
我也尝试过如下设置.pip / pip.conf:
[global]
timeout = 60
proxy = http://<my_proxy>:<my_port>
作为另一个数据点,如果有帮助,来自命令行的nslookup
对于公司内部网外部的域失败,但适用于其中的域。然而,如上所述,Firefox和apt-get似乎没有使用代理解析域名的问题。
有什么想法吗? 谢谢!