問題:
pip install tensorflow==1.1.0
Collecting tensorflow==1.1.0
Downloading tensorflow-1.1.0-cp27-cp27mu-manylinux1_x86_64.whl (31.0MB)
1% |▋? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | 593kB 31kB/s eta 0:15:52Exception:
Traceback (most recent call last):
File "/home/weishu/tensorflow/local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/home/weishu/tensorflow/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.py", line 246, in _error_catcher
raise ReadTimeoutError(self._pool, None, 'Read timed out.')
ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out.
解決方案1:
?pip --default-timeout=1000 install -U pip
依舊不行
解決方案2:
pip 源更改設置
pipy 國內鏡像目前有:
http://pypi.douban.com/ 豆瓣
http://pypi.hustunique.com/ 華中理工大學
http://pypi.sdutlinux.org/ 山東理工大學
http://pypi.mirrors.ustc.edu.cn/ 中國科學技術大學
手動指定源:
在pip 后面跟-i 來指定源,比如用豆瓣的源來安裝web.py 框架:
pip install web.py -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