ImportError: libtorch_cuda_cu.so ... No such file or directory “mmseg.models“导入报错

最近在学习图像分割,用的MMSegmentation框架,跑demo是遇到报错

ImportError: libtorch_cuda_cu.so: cannot open shared object file: No such file or directory

mmseg、mmcv 均能正常导入,然而from mmseg.models.builder import build_segmentor 出现问题

ImportError: libtorch_cuda_cu.so ... No such file or directory “mmseg.models“导入报错_第1张图片

本人的pytorch环境: pytorch=1.11.0、cudatoolkit=11.3.1、torchvision=0.12.0、mmcv-full=1.6.0、mmsegmentation=0.26.0 

网上说需要从源码安装,没有试过。说下我的解决方法:

1.卸载当前安装的mmcv-full

pip uninstall mmcv-full

2.使用conda安装,错误消失

conda search mmcv-full

ImportError: libtorch_cuda_cu.so ... No such file or directory “mmseg.models“导入报错_第2张图片

conda install mmcv-full=1.5.3 -y

不建议使用官方文档给的安装方式

pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html

你可能感兴趣的:(python)