PIP 不工作 - 代理 [英] PIP not working - proxy

查看:24
本文介绍了PIP 不工作 - 代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

python pip 不能在代理后面工作

python pip is not working behind proxy

我试过了

sudo -H pip --proxy https://proxy_ip:proxy_port install <package>

sudo -H pip --proxy https://usename:password@proxy_ip:proxy_port install <package>

sudo easy_install pip

没有任何效果,我也尝试设置环境变量 HTTP_PROXY 但它不起作用.

and nothing is working, I also tried setting environment variables HTTP_PROXY but it isn't working.

例如,这是尝试安装 toolz 时的错误:

For instance, here is the error when trying to install toolz:

 Collecting toolz
  Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 407 Proxy Authentication Required',))': /simple/toolz/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 407 Proxy Authentication Required',))': /simple/toolz/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 407 Proxy Authentication Required',))': /simple/toolz/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 407 Proxy Authentication Required',))': /simple/toolz/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 407 Proxy Authentication Required',))': /simple/toolz/
  Could not find a version that satisfies the requirement toolz (from versions: )
No matching distribution found for toolz

推荐答案

问题出在加载旧代理设置的 conf 文件中.此外,环境变量区分大小写.所以在linux中使用printenv检查HTTP_PROXY和http_proxy是否有区别

The problem was within a conf file that loads old proxy settings. Also the environment variables are case sensitive. So check if there is a difference between HTTP_PROXY and http_proxy by using printenv in linux

然后正如@MedAli 建议的那样:在使用 pip 时添加 --proxy 将起作用

Then as @MedAli suggested: adding --proxy while using pip will work

这篇关于PIP 不工作 - 代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆