解决RuntimeError: CUDA unknown error - this may be due to an incorrectly set up environment

RuntimeError: CUDA unknown error - this may be due to an incorrectly set up environment, e.g. changing env variable CUDA_VISIBLE_DEVICES after program start.

在import torch的时候就报了这个错,试了一下在程序中设置环境变量并不能解决这个问题。

最终解决方案:

sudo apt-get install nvidia-modprobe

猜你喜欢

转载自blog.csdn.net/wenqiwenqi123/article/details/129836817