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

【尊重原创】python

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

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

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

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

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

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

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

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

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

配置文件 : 
若须要建立或修改配置文件( 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
相关文章
相关标签/搜索