参考:https://zhuanlan.zhihu.com/p/89714824
用 nvidia-smi
查看一下,提示如下错误:
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver.
Make sure that the latest NVIDIA driver is installed and running.
又用 nvcc -V
看了一下驱动还在,网上搜了一下,用下面的方法顺利解决了问题 ,参考:https://blog.csdn.net/hangzuxi8764/article/details/86572093
sudo apt install dkms
sudo dkms install -m nvidia -v 418.87.00
其中,418.87.00 是之前安装 nvidia 驱动的版本号,可通过下面方法查到:
ls /usr/src | grep nvidia
如果安装过程出现错误,可能是gcc版本不对,需要切换版本,比如nvidia-450就需要gcc7,gcc5安装会出错