【尊重原創】python
http://blog.csdn.net/weixin_34722995/article/details/71751837linux
Question:
python安裝第三方庫超時報錯—–Read time outwindowsAnswer:
①使用國內鏡像安裝
②設置超時時間url第一種方法:
pipy 國內鏡像目前有:spahttp://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