参考了:Ubuntu 卸载 Nvidia 驱动和安装最新驱动_WMSmile的博客-CSDN博客_ubuntu 卸载nvidia驱动
1 完全卸载驱动:
sudo apt-get --purge remove nvidia*
sudo apt autoremove
To remove CUDA Toolkit:
sudo apt-get --purge remove "*cublas*" "cuda*"
To remove NVIDIA Drivers:
sudo apt-get --purge remove "*nvidia*"
2 安装驱动
2.1 如果没有版本要求:
ubuntu-driver devices ##查看系统推荐的版本,
sudo apt install nvidia-driver-510 ##根据推荐的版本安装
2.2 按照自己的版本要求安装,
去**NVDIA 驱动官网**搜索你的显卡需要的驱动型号并下载自己要的版本
2.2.1 禁用nouveau
sudo gedit /etc/modprobe.d/blacklist.conf
在blacklist.conf文件末尾加上这两行,并保存:
blacklist nouveau
options nouveau modeset=0
执行 sudo update-initramfs -u
重启 reboot
2.2.2 安装驱动
sudo chmod a+x NVIDIA-Linux-x86_64-xxx.run #根据自己下载的版本补全
sudo ./NVIDIA-Linux-x86_64-455.45.01.run -no-x-check -no-nouveau-check -no-opengl-files
安装过程中的选项
The distribution-provided pre-install script failed! Are you sure you want to continue? 选择 yes 继续。
Would you like to register the kernel module souces with DKMS? This will allow DKMS to automatically build a new module, if you install a different kernel later? 选择 No 继续。
问题没记住,选项是:install without signing
问题大概是:Nvidia's 32-bit compatibility libraries? 选择 No 继续。
Would you like to run the nvidia-xconfigutility to automatically update your x configuration so that the NVIDIA x driver will be used when you restart x? Any pre-existing x confile will be backed up. 选择 Yes
完成之后 reboot,查看nvidia-smi
卸载:
sudo apt-get --purge remove "*nvidia*"
sudo /usr/bin/nvidia-uninstall