pip安装Flask失败
问题:pip一直无法安装flask
原因:原来是镜像源太慢的原因导致下载不全
解决办法:
指定单个库的安装源 v2ex,特别快,感谢v2ex提供镜像
pip install flask -i http://pypi.v2ex.com/simple
解决办法扩展:
建个pip的配置文件 ~/.pip/pip.conf
内容如下:
[global]
timeout = 6000 #配置超时时间,以免下载不完全
index-url = http://pypi.v2ex.com/simple #配置比较快的pip源,可在PyPI Mirror查看镜像的活跃度。选择CN地区合适的镜像即可。
[install]
use-mirrors = true
mirrors = http://e.pypi.python.org
问题详情:
Downloading/unpacking Flask
Downloading Flask-0.10.1.tar.gz (544kB): 339kB downloaded
Cleaning up...
Exception:
Traceback (most recent call last):
File "/home/maoyi/venv/lib/python2.6/site-packages/pip/basecommand.py", line 134, in main
status = self.run(options, args)
File "/home/maoyi/venv/lib/python2.6/site-packages/pip/commands/install.py", line 236, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/home/maoyi/venv/lib/python2.6/site-packages/pip/req.py", line 1092, in prepare_files
self.unpack_url(url, location, self.is_download)
File "/home/maoyi/venv/lib/python2.6/site-packages/pip/req.py", line 1238, in unpack_url
retval = unpack_http_url(link, location, self.download_cache, self.download_dir)
File "/home/maoyi/venv/lib/python2.6/site-packages/pip/download.py", line 622, in unpack_http_url
download_hash = _download_url(resp, link, temp_location)
File "/home/maoyi/venv/lib/python2.6/site-packages/pip/download.py", line 495, in _download_url
chunk = resp.read(4096)
File "/usr/lib64/python2.6/socket.py", line 383, in read
data = self._sock.recv(left)
File "/usr/lib64/python2.6/httplib.py", line 542, in read
s = self.fp.read(amt)
File "/usr/lib64/python2.6/socket.py", line 383, in read
data = self._sock.recv(left)
File "/usr/lib64/python2.6/ssl.py", line 215, in recv
return self.read(buflen)
File "/usr/lib64/python2.6/ssl.py", line 136, in read
return self._sslobj.read(len)
SSLError: The read operation timed out