真是忙活了半天终于解决了!
尝试了网上各种办法都没用。
学校服务器都没遇到这种问题,自己电脑遇到了。
The detected CUDA version (12.2) mismatches the version that was used to compile
PyTorch (11.8). Please make sure to use the same CUDA versions.
解决办法:
这个解决办法是你在尝试了网上其他办法没用并且你的cuda大版本和你torch安装的大版本不一致的情况下使用(比如cuda11.x,torch121或者cuda12.2,torch118)。
如果你的cuda版本是11.x你安装的时候就可以用如下命令安装
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
如果你的cuda版本是12.x。你安装torch的时候用如下命令安装:
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121