【Python】用pip安装python库下载超时的解决办法

xiaoxiao2021-02-28  86

超时提示

During handling of the above exception, another exception occurred: Traceback (most recent call last): ######################################## raise ReadTimeoutError(self._pool, None, 'Read timed out.') pip._vendor.requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out.

解决办法

源地址不稳定,下载速率慢,可以通过修改源地址解决。

方法一

直接在命令行中指定源地址,如下: pip install -i https://pypi.doubanio.com/simple/ 包名或者: pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple 包名以上两个源地址的下载速度都很快。

方法二

在配置文件中修改源地址,如下: 建一个 ~/.pip/pip.conf文件,添加内容如下 [global] index-url = http://b.pypi.python.org/simple [install] use-mirrors = true mirrors = http://b.pypi.python.org也可以在[global]中加入timeout = 6000,以防止网速过慢情况下包下载不完

转载请注明原文地址: https://www.6miu.com/read-75866.html

最新回复(0)