pip install超时


报错信息

in _error_catcher
raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

我们在使用pip安装一些类库的时候发现会超时,导致无法正常下载,可能原因是因为网络的原因。

解决方法

1.增加超时的时间,如:

安装xlrd的时候指定超时时间为1000秒

pip install --default-timeout=1000 xlrd

2. 使用国内的pip源

比如用清华的源安装pandas

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pandas

【更多源】

阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban)http://pypi.douban.com/simple/
清华大学https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学http://pypi.mirrors.ustc.edu.cn/simple/