python的pip安装超时问题解决


使用pip install 安装python第三方库时出现了如下错误:
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host=‘files.pythonhosted.org’, port=443): Read timed out.

 

 原因分析:

使用pip下载python第三方库时,由于国内网络的限制,下载速度缓慢,而超过一定时长时,就默认下载失败。

解决方法:

1:延长超时时间

pip3 install --default-timeout=1000 "包的名称"

2:更改下载源

由于默认的国外下载源下载速度十分缓慢,所以可以选择国内的几个比较好的镜像

阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/
豆瓣 http://pypi.doubanio.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/

使用命令:

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

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM