Pau*_*ulP 5 python ubuntu vpn proxy pip
我的设置:
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>"
Run Code Online (Sandbox Code Playgroud)
为了获得工作能力,修改了/etc/apt/apt.conf.d/01proxy:
Acquire::http::Proxy “http://<my_proxy>:<my_port>"
Run Code Online (Sandbox Code Playgroud)
要在使用sudo时保持env变量,修改/etc/sudoers.d/proxy:
Defaults env_keep += "http_proxy https_proxy ftp_proxy"
Run Code Online (Sandbox Code Playgroud)
我还在设置 - >网络 - >网络代理中设置了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
Run Code Online (Sandbox Code Playgroud)
我尝试使用--proxy选项(--proxy=http://<my_proxy>:<my_port>带/不带=符号,带/不带引号),但即便如此也显示相同的错误.
我也尝试过如下设置.pip/pip.conf:
[global]
timeout = 60
proxy = http://<my_proxy>:<my_port>
Run Code Online (Sandbox Code Playgroud)
作为另一个数据点,如果它有帮助,nslookup从命令行失败的企业内部网外的域,但适用于其中的域.然而,如前所述,Firefox和apt-get似乎没有使用代理解析域名的问题.
有任何想法吗?谢谢!