当我尝试使用此命令安装 fastApi 时:
pip install fastapi
它给了我这个警告:
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.u
rllib3.connection.HTTPSConnection object at 0x000001BD957B4050>: Failed to establish a new connection: [WinError 10051] A socket operation was attempted to an unreachable network')': /packages/1a/e3/73b448c6a5eef9106caeafc83c6d84de065c2acab2e9032e22a02d72b16c/pdm-2.22.0-py3-none-any.whl.metadata
然后给我这个错误:
ERROR: Could not install packages due to an OSError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packa
ges/52/b3/7e4df40e585df024fac2f80d1a2d579c854ac37109675db2b0cc22c0bb9e/fastapi-0.115.6-py3-none-any.whl.metadata (Caused by NewConnectionError('<pip._ve
ndor.urllib3.connection.HTTPSConnection object at 0x0000026D704C4620>: Failed to establish a new connection: [WinError 10051] A socket operation was attempted to an unreachable network'))
使用 PIP 命令下载任何包时也会出现此错误。 那么请问如何修复这个错误?
尝试了多种解决方案后(都不起作用)。我只是重新启动我的路由器设备,它就可以工作了。