python的pip安装超时问题解决

前端之家收集整理的这篇文章主要介绍了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 库名

 

猜你在找的Python相关文章