你好,大约 2 周前,我开始无法下载 python 包,甚至无法访问在 chrome 和 firefox 上“无法访问”的 pypi 网站。
当我尝试下载一个包时,它给了我这个:
$ python -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose
Collecting numpy
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/numpy/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/numpy/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/numpy/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/numpy/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/numpy/
Could not find a version that satisfies the requirement numpy (from versions: )
No matching distribution found for numpy
我不知道为什么会这样,我没有在我的电脑上做任何改变,它只是有一天开始在我的两台电脑上做这个,我不明白。有人知道为什么会这样吗?我搜索了几个小时,但找不到任何东西来纠正这个错误。
我尝试过的: - 卸载每个 python 程序并重新安装 - 检查我的驱动程序(你永远不知道) - 停用任何代理 - 禁用我的防火墙
操作系统:Windows 10
原文由 Shraneid 发布,翻译遵循 CC BY-SA 4.0 许可协议
因此,对于寻找解决方案的任何人,我发现这可能不是最佳的,但至少它有效,而不是
pip install package
使用这个命令python.exe -m pip install package --proxy="proxy:port"
您可以在此处找到大量免费代理: https ://free-proxy-list.net/(请注意,并非所有代理都有效,您可能想尝试多个才能获得有效代理)
因此,例如您可以使用:
python.exe -m pip install numpy --proxy="179.185.199.195:8080"