python - 在 Windows 上 Pip 无法访问端口 443,但浏览器可以
问题描述
我的机构运行了一个过滤器,使不太安全的站点无法访问。我可以使用浏览器访问的一个网站是
https://pypi.python.org/simple/waitress/
然而,如果我pip -vvv install waitress
从 Anaconda 命令提示符运行(所有包都出现问题,而不仅仅是女服务员),我得到:
Could not fetch URL https://pypi.python.org/simple/waitress/:
connection error: HTTPSConnectionPool(host='pypi.python.org', port=443):
Max retries exceeded with url: /simple/waitress/ (Caused by
NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection
object at 0x00000000050FD400>:
Failed to establish a new connection: [WinError 10061]
No connection could be made because the target machine
actively refused it',)) - skipping
我可以请求选择性地打开必要的 URL,但在这种情况下,端口 443 似乎pypi.python.org
已经打开。
你能解释一下这个谜题吗?为什么 pip 无法访问浏览器(在同一台机器上)可以访问的站点?
解决方案
这是一个使用 ssl 的简单解决方案,自 pip 10.0 发布以来,您应该能够通过升级 pip 本身来永久修复此问题:
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org pip waitress
让我知道是否有效