【转】python pip 安装第三方库超时报错“Read time out”的解决办法

【尊重原创】

http://blog.csdn.net/weixin_34722995/article/details/71751837

Question: 
python安装第三方库超时报错—–Read time out

Answer: 
①使用国内镜像安装 
②设置超时时间

第一种方法: 
pipy 国内镜像目前有:

   http://pypi.douban.com/ 豆瓣

   http://pypi.hustunique.com/ 华中理工大学

   http://pypi.sdutlinux.org/ 山东理工大学

   http://pypi.mirrors.ustc.edu.cn/ 中国科学技术大学

手动指定源: 
在 pip 后面跟-i 来指定源,比如用豆瓣的源来安装 whois库: 
pip install whois -i http://pypi.douban.com/simple 
注意后面要有 /simple 目录!!!

配置文件 : 
若需要创建或修改配置文件( linux 的文件在~/.pip/pip.conf , windows 在%HOMEPATH%\pip\pip.ini ),修改内容为:

[global] 
index-url = http://mirrors.aliyun.com/pypi/simple/ 
[install] 
trusted-host=mirrors.aliyun.com 
如果不加后面的 install 
则需要每次在命令后面加上 –trusted-host

第二种方法: 
安装whois库: 
pip –default-timeout=100 install -U whois

 

【实践过程】

个人配置信息贴上:

D:\Users\yangwz\pip\pip.ini 

[global]
timeout = 60
index-url = http://pypi.douban.com/simple
trusted-host = pypi.douban.com

[install]
use-mirrors = true
mirrors = http://pypi.douban.com
trusted-host = pypi.douban.com

 

posted @ 2018-02-24 14:51  慕U洲  阅读(490)  评论(0)    收藏  举报