'ProxyError('无法连接到代理。',NewConnectionError

时间:2019-05-07 05:44:55

标签: python http networking https mozilla

在pycharm中安装任何python软件包时。出现以下错误:- 收集py2neo

Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fb8e2e15780>: Failed to establish a new connection: [Errno 111] Connection refused',))': /simple/py2neo/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fb8e2e155f8>: Failed to establish a new connection: [Errno 111] Connection refused',))': /simple/py2neo/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fb8e2e15898>: Failed to establish a new connection: [Errno 111] Connection refused',))': /simple/py2neo/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fb8e2e154a8>: Failed to establish a new connection: [Errno 111] Connection refused',))': /simple/py2neo/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fb8e2e15400>: Failed to establish a new connection: [Errno 111] Connection refused',))': /simple/py2neo/
  Could not find a version that satisfies the requirement py2neo (from versions: )
No matching distribution found for py2neo

1 个答案:

答案 0 :(得分:0)

我在公司代理后面的Docker容器中遇到了完全相同的错误。无论我要安装哪个软件包。

我可以将其固定为以下内容:

一旦设置了任何代理环境变量(https_proxy或HTTPS_PROXY),我就会收到此错误。奇怪的是,这是否是正确的代理并不重要。另外,我体验到,当设置了这些变量之一时,pip似乎会忽略我在安装过程中通过--proxy开关传递的信息。

我通过以下变通办法使它正常工作:

  1. 确保既未设置https_proxy(小写),又未设置HTTPS_PROXY(大写)环境var。
  2. 使用以下命令运行pip安装
pip3 --proxy=http://<proxyHost>:<proxyPort> install  py2neo

尽管此变通办法对我有效,但我仍然有兴趣为此找到解决方法,

  1. 我真的很好奇那里发生的事情
  2. 不得不在Dockerfile内部的命令中指定代理有点烦人