安装Pytorch报错:ERROR: Exception:Traceback (most recent call last):TimeoutError: The read operation time

博客主要讲述下载PyTorch时出现报错,原因是下载速度慢和网络不稳定。解决办法一是去掉pip3的3,二是采用国内镜像源,如清华的PyTorch镜像源,最终下载成功。
该文章已生成可运行项目,

出现报错:
ERROR: Exception:Traceback (most recent call last):File "C:\Users\22939\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\urllib3\response.py", line438, in _error_catcheryieldFile "C:\Users\22939\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\urllib3\response.py", line561, in readdata = self._fp-read(amt) if not fp-closed else b"File "C:\Users\22939\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\urllib3\response.py", line527, in -fp_read return self._fp.read(amt) if amt is not None else self._fp.read()File "C:\Users\22939\AppData\Local\Programs\Python\Python310\Lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py,line 90, in readdata = self._-fp.read(ant)File "C:\Users\22939\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 465, in read5 = self.fp.read(amt)File "C:\Users\22939\AppData\Local\Programs\Python\Python310\Lib\socket.py", line 7e5, in readintoreturn self._sock.recv_into(b)File "C:\Users\22939\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 1274, in recv_intoreturn self.read(nbytes, buffer)File "C:\Users\22939\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 1130, in readreturn self._sslobj.read(len, buffer)TimeoutError: The read operation timed out

下载pytorch的时候出现了这样的情况:
image-20240119122205752

原因是下载速度太慢以及网络不稳定导致的

💡解决办法:

  1. 有可能是因为没有配置pip3,把3去掉试试

image-20240119123045091

  1. 采用国内镜像源,这里我采用的是清华的pytorch镜像源
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple torch torchvision torchaudio

image-20240119122356366

下载成功

本文章已经生成可运行项目
在pip install scikit-learn完事后出现以下报错ERROR: Exception: Traceback (most recent call last): File "E:\Anaconda\envs\pytorch\lib\site-packages\pip_vendor\urllib3\response.py", line 438, in _error_catcher yield File "E:\Anaconda\envs\pytorch\lib\site-packages\pip_vendor\urllib3\response.py", line 561, in read data = self._fp_read(amt) if not fp_closed else b"" File "E:\Anaconda\envs\pytorch\lib\site-packages\pip_vendor\urllib3\response.py", line 527, in _fp_read return self._fp.read(amt) if amt is not None else self._fp.read() File "E:\Anaconda\envs\pytorch\lib\site-packages\pip_vendor\cachecontrol\filewrapper.py", line 90, in read data = self.__fp.read(amt) File "E:\Anaconda\envs\pytorch\lib\http\client.py", line 463, in read n = self.readinto(b) File "E:\Anaconda\envs\pytorch\lib\http\client.py", line 507, in readinto n = self.fp.readinto(b) File "E:\Anaconda\envs\pytorch\lib\socket.py", line 704, in readinto return self._sock.recv_into(b) File "E:\Anaconda\envs\pytorch\lib\ssl.py", line 1242, in recv_into return self.read(nbytes, buffer) File "E:\Anaconda\envs\pytorch\lib\ssl.py", line 1100, in read return self._sslobj.read(len, buffer) socket.timeout: The read operation timed out During handling of the above exception, another exception occurred: Traceback (most recent call last): File "E:\Anaconda\envs\pytorch\lib\site-packages\pip_internal\cli\base_command.py", line 160, in exc_logging_wrapper status = run_func(*args) File "E:\Anaconda\envs\pytorch\lib\site-packages\pip_internal\cli\req_command.py", line 247, in wrapper return func(self, options, args) File "E:\Anaconda\envs\pytorch\lib\site-packages\pip_internal\commands\install.py", line 419, in run requirement_set = resolver.resolve( File "E:\Anaconda\envs\pytorch\lib\site-packages\pip_internal\resolution\resolvelib\resolver.py", line 92, in resolve result = self._result = resolver.resolve( File "E:\Anaconda\envs\pytorch\lib\site-packages\pip_vendor\resolvelib\resolvers.py"这是什么原因
06-11
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值