NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running
(在这之前,不要忘记在bios中关闭?secure boot!!!)
一:执行这三条命令:
# 删除之前安装的nvidia驱动
sudo apt-get purge nvidia-*
# 更新
sudo apt-get update
# 删的干净一些
sudo apt-get autoremove
二:执行这条命令:
# 为了查找适配自己电脑的nvidia驱动
apt search nvidia-driver
出现了许多显卡驱动,安装最新版(不建议安装后缀带open的驱动,参考:nvidia-smi 输出“No devices were found_nvidia-smi no devices were found-CSDN博客)
例如我当时推荐的最新版本是:nvidia-driver-535
三:安装驱动依赖(注意每个人的数字不一定相同,记得改变):
# 注意最后的数字与你安装的驱动版本一致,我这里是535
sudo apt install libnvidia-common-535
sudo apt install libnvidia-gl-535
四:安装nvidia-smi驱动
# 注意,要与上面的数字保持同步
sudo apt install nvidia-driver-535
五:执行nvidia-smi,有报错不要慌,还差一步重启:
reboot
正常情况下,重启后执行nvidia-smi就会正常显示了