Python错误集锦:在安装模块过程中出现socket.timeout: The read operation timed out

原文链接:http://www.juzicode.com/archives/2238

错误提示:

在安装模块过程中提示:socket.timeout: The read operation timed out,并连续发生错误,pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host=’files.pythonhosted.org’, port=443): Read timed out.

  File "d:\python\python38\lib\ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out


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

可能原因:

1、国外的源不稳定。

 

解决方法:

1、改用国内的源安装,增加-i 选项,选择国内的源:

可选的其他源:

豆瓣:https://pypi.douban.com/simple/
清华:https://pypi.tuna.tsinghua.edu.cn/simple
阿里云:https://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple
posted @ 2020-11-25 18:58  桔子code  阅读(781)  评论(0)    收藏  举报