[Python]解决ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out

在使用pip 下载安装其他库的时候,有时候会遇到read timeout 的问题。原因是被GFW挡,这里有2种方法解决这个问题

方法一

使用国内源来安装(不成功的话就换一个源),比如:

sudo pip install -i https://pypi.douban.com/simple xxx(需要安装的库)

国内源:

http://pypi.douban.com/ 豆瓣
http://pypi.hustunique.com/ 华中理工大学
http://pypi.sdutlinux.org/ 山东理工大学
http://pypi.mirrors.ustc.edu.cn/ 中国科学技术大学
https://pypi.tuna.tsinghua.edu.cn/ 清华大学

方法二

增加延时

pip install --default-timeout=1000 --no-cache-dir -r ~/requirements.txt (此txt内容为你要安装的库的list,按行依次往里写入你要的库名称)
posted @ 2020-07-21 14:01  萧蔷ink  阅读(2335)  评论(0编辑  收藏  举报