我正在使用Mac,并尝试通过pip安装软件包:
(venv) ➜ ✗ pip install -r requirements.txt
Collecting certifi==2019.9.11 (from -r requirements.txt (line 1))
http://127.0.0.1:6152
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 0x1041660d0>: Failed to establish a new connection: [Errno 61] Connection refused'))': /simple/certifi/
http://127.0.0.1:6152
我修改了pip的代码,以便它可以打印我使用的代理
venv/lib/python3.8/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/urllib3/connectionpool.py
:urlopen
方法:
elif isinstance(e, (SocketError, NewConnectionError)) and self.proxy:
print(self.proxy) # add this line
e = ProxyError('Cannot connect to proxy.', e)
但我在我的export
里什么也没找到:
(venv) ➜ ✗ export | grep proxy
(venv) ➜ ✗
那么,如何禁用我使用的代理(http://127.0.0.1:6152)
阅读代码后,我在
/lib/python3.8/urllib/request.py
中发现:请注意:
urllib
从两个来源获取代理:我调试过,它从sys得到了代理。所以我检查我的网络设置:
我找到了配置代理的地方
相关问题 更多 >
编程相关推荐