点子无法在防火墙后面工作 [英] Pip not working behind firewall
问题描述
我正在尝试从公司防火墙后面使用pip,并且没有任何运气.
I am trying to use pip from behind a corporate firewall, and not having any luck.
我已经设置了http_proxy
和https_proxy
环境变量. wget可以工作,但是不可以.
I have set the http_proxy
and https_proxy
environment variables. wget works, but not pip.
我尝试过了...
sudo -E pip install virtualenv
这些代理...
export http_proxy=myproxyname.mydomain.com:8080
export https_proxy=myproxyname.mydomain.com:8080
...并获得了很长的堆栈跟踪,并以此结束
... and got a long stacktrace which ended with this
/requests/packages/urllib3/poolmanager.py", line 214, in __init__
'Not supported proxy scheme %s' % self.proxy.scheme
AssertionError: Not supported proxy scheme None
我查看了poolmanager.py源.似乎需要代理变量以方案开头.所以我再次尝试了以下代理...
I looked at the poolmanager.py source. It looks like it is requiring the proxy variables to begin with a scheme. So I tried again with the following proxies ...
export http_proxy=http://myproxyname.mydomain.com:8080
export https_proxy=https://myproxyname.mydomain.com:8080 (also tried this with http://)
...,我收到以下错误消息
... and I get the following error
Downloading/unpacking virtualenv
Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement virtualenv
Cleaning up...
No distributions at all found for virtualenv
Storing debug log for failure in /root/.pip/pip.log
这是我完全没有代理时遇到的相同错误,尽管设置代理后速度更快.
This is the same error I get when I do not have a proxy at all, though I get it much faster when the proxies are set.
当我尝试wget ...
When I try wget ...
wget --no-check-certificate https://pypi.python.org/simple/
它工作正常,所以我认为代理本身似乎还可以,除非我尝试使用pip进行尝试.
It works fine, so I think the proxies themselves seem ok, unless I try them with pip.
使用--proxy
选项代替envvars并没有帮助.结果相同.
Using the --proxy
option instead of envvars did not help. Same results.
有什么想法吗?
谢谢, 豆
推荐答案
使用--trusted-host参数.
Use the --trusted-host argument.
我想出了如何使用--trusted-host参数使其在公司防火墙后与我一起工作.
I figured out how to get it to work with me behind my corporate firewall using the --trusted-host argument.
我的第一次尝试是:
pip install matplotlib
失败的文字是这样的:
无法获取URL https://pypi.python.org/simple/matplotlib/:在那里 确认ssl证书时出现问题:[SSL: CERTIFICATE_VERIFY_FAILED]证书验证失败(_ssl.c:645)- 跳过
Could not fetch URL https://pypi.python.org/simple/matplotlib/: There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645) - skipping
所以我尝试了这个可行的方法:
So then I tried this which worked:
pip3.5 install matplotlib --trusted-host pypi.python.org
这篇关于点子无法在防火墙后面工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!