1 卸载驱动库
sudo apt-get --purge remove nvidia* -y
sudo apt autoremove -y
卸载cuda
dpkg -l | grep nvidia
2 卸载依赖文件
sudo apt-get --purge remove "*nvidia*" -y
也可用:NVIDIA-Linux-x86_64-465.31.run --uninstall卸载,大同小异。
3 检查卸载是否彻底
dpkg -l | grep nvidia
如果卸载干净了,这条指令后将无提示。
安装新版本
驱动程序 下载适合自己环境的驱动,以下以ubuntu 安装Nvidia 525.147.05 版本驱动为例
第一步
sudo dpkg -i nvidia-driver-local-repo-ubuntu2204-525.147.05_1.0-1_amd64.deb
复制文件
sudo cp /var/nvidia-driver-local-repo-ubuntu2204-525.147.05/nvidia-driver-local-CA67E107-keyring.gpg /usr/share/keyrings/
更新
sudo apt update -y
安装驱动
sudo apt install nvidia-driver-525 nvidia-dkms-525 -y
重启系统
sudo reboot now
重启系统后验证
nvidia-smi
正常会显示如下内容
Fri May 10 09:42:42 2024
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.147.05 Driver Version: 525.147.05 CUDA Version: 12.0 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA GeForce ... On | 00000000:02:00.0 Off | N/A |
| 40% 33C P8 N/A / 75W | 1MiB / 4096MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
| 1 Tesla P40 On | 00000000:81:00.0 Off | Off |
| N/A 26C P8 9W / 250W | 0MiB / 24576MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+