解决RuntimeError: Couldn‘t load custom C++ ops. This can happen if your PyTorch

问题描述

刚下好yolov8的代码,想测一下能否成果,果然没成功,报错如下

RuntimeError: Couldn't load custom C++ ops. This can happen if your PyTorch and torchvision versions are incompatible, or if you had errors while compiling torchvision from source. For f
urther information on the compatible versions, check https://github.com/pytorch/vision#installation for the compatibility matrix. Please check your PyTorch version with torch.__version__
 and your torchvision version with torchvision.__version__ and verify if they are compatible, and if not please reinstall torchvision so that it matches your PyTorch install.

简单来说就是torchvision和torch不匹配,就很离谱,我照着版本对应关系pip install的啊,怎么会不匹配
建议先看看你的版本

python
import torch
import torchvision
print(torch.__version__)
print(torchvision.__version__)

我是下图红框这个
在这里插入图片描述

版本对应博文

首先确定自己torch没问题,因为我的3090这个卡目前cuda版本是11.1,这个whl是早就下好的,一般1-2G,有问题重新下就麻烦了
在这里插入图片描述

在这里插入图片描述
然后我pip install了很多次torchvision==0.11.3,都没啥用。想试着改改版本,结果要下其他的torch版本,就更不可能了。

解决

如果版本对的上,而且后缀都有cu111就没问题了,我的torchvision下了好多次,都没有这个后缀
在这里插入图片描述
方法:去官网https://pytorch.org/get-started/previous-versions/,找到你想要的版本,复制后面的网址
在这里插入图片描述
就是比如这个网址,https://download.pytorch.org/whl/cu111/torchvision/,找到要的whl下载后,本地pip install就好了

在这里插入图片描述

相关推荐

  1. XML 解析异常问题解决

    2024-07-19 12:04:01       27 阅读
  2. 域名解析出错的解决办法

    2024-07-19 12:04:01       19 阅读
  3. Edge问题解决教程

    2024-07-19 12:04:01       56 阅读
  4. 跨域怎么解决

    2024-07-19 12:04:01       56 阅读
  5. php解决XSS攻击

    2024-07-19 12:04:01       54 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-19 12:04:01       66 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-19 12:04:01       70 阅读
  3. 在Django里面运行非项目文件

    2024-07-19 12:04:01       57 阅读
  4. Python语言-面向对象

    2024-07-19 12:04:01       68 阅读

热门阅读

  1. 声音处理:分帧与加窗

    2024-07-19 12:04:01       20 阅读
  2. spring 同类方法调用事务失效解决办法

    2024-07-19 12:04:01       13 阅读
  3. 前端面试题日常练-day93 【Less】

    2024-07-19 12:04:01       20 阅读
  4. 【.NET】图形库SkiaSharp

    2024-07-19 12:04:01       20 阅读
  5. OpenCV教程:cv2图像逻辑运算

    2024-07-19 12:04:01       19 阅读
  6. 学习补充008-xx-01 Migrations Overview(迁移概述)

    2024-07-19 12:04:01       19 阅读