安装torch和opencv出现大面积报错红色代码Read timed out.的问题

之前安装torch的时候可以很快成功,最近在服务器上安装torch的时候出现大面积报错
如图所示:
在这里插入图片描述
最后一句显示readtimeouterror
raise ReadTimeoutError(self._pool, None, “Read timed out.”)
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host=‘files.pythonhosted.org’, port=443): Read timed out.
首先要确定你安装的torch版本是否匹配

第一个方法

多给些等待时间,如果下的包很大,容易出现runtimeerr问题

pip --default-timeout=1000 install -U torch==1.12.0 torchvision==0.13.0 -f https://download.pytorch.org/whl/torch_stable.html -i https://pypi.tuna.tsinghua.edu.cn/simple/

第二个方法:换源

阿里: http://mirrors.aliyun.com/pypi/simple/
清华: https://pypi.tuna.tsinghua.edu.cn/simple
豆瓣: http://pypi.douban.com/simple/

第三个方法:直接下载whl文件

点这
去这里下载你需要对应包的.whl文件
随后直接cd到下载文件的文件夹
实施pip install命令
在这里插入图片描述
这个方法是尝试过后最快的

其他

如果下载的是torch包
先下好torchbvision

 pip install torchvision==0.13.0 -i https://pypi.tuna.tsinghua.edu.cn/simple

随后,窗口会自动帮你下载torch

猜你喜欢

转载自blog.csdn.net/fcxgfdjy/article/details/129653665