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/

相关阅读:

  1. Python进阶教程m1–模块(module)

关注微信公众号:“桔子code”,欢迎后台留言撩我,我会尽我所能为你解惑Python,C等编程知识

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注