现象:

 会出现如图所示类似的超时报错:

ERROR: Could not install packages due to an OSError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/86/cd/619a45613393293117297f2f0e5086a619e1ea98c5e2ce6d0f554ddc97c3/matplotli
b-3.5.1-cp39-cp39-win_amd64.whl (Caused by ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000002C5D01673D0>, 'Connection to files.pythonhosted.org timed out. (connect timeout=15)'))

原因:

一般情况下pip出现ReadTimeoutError的情况,是由于我们下载的是国外的包,下载速度较慢,从而导致超时,所以一般遇到这种问题,我们可以选择国内的镜像来解决问题。

解决:

使用国内镜像仓库:

清华大学镜像:https://pypi.tuna.tsinghua.edu.cn/simple/
阿里云:http://mirrors.aliyun.com/pypi/simple/
中科大镜像:https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣镜像:http://pypi.douban.com/simple/
中科大镜像2:http://pypi.mirrors.ustc.edu.cn/simple/

使用:

#示例如下:

pip install matplotlib -i https://pypi.tuna.tsinghua.edu.cn/simple/

结果:

 

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐