Linux nvidia 报错(1):nvidia-smi: command not found

文章目录

  • 1. 问题:`nvidia-smi: command not found`
  • 2. 解决:
  • 3. 终结:VMware虚拟机上不能使用CUDA/CUDNN

1. 问题:nvidia-smi: command not found

2. 解决:

sudo apt purge nvidia-*  # 解除 Nvidia Driver
sudo add-apt-repository ppa:graphics-drivers/ppa # 通过 PPA 为 Ubuntu 安装 Nvidia 驱动程序
sudo apt update
sudo apt install nvidia-418

显示成功:

DKMS: install completed.
Setting up nvidia-prime (0.8.2) ...
Setting up screen-resolution-extra (0.17.1.1~16.04.1) ...
Setting up nvidia-settings (418.56-0ubuntu0~gpu16.04.1) ...
Setting up vdpau-driver-all:amd64 (1.2-0ubuntu0~gpu16.04.1) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Processing triggers for initramfs-tools (0.122ubuntu8) ...
update-initramfs: Generating /boot/initrd.img-4.4.0-21-generic
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for dbus (1.10.6-1ubuntu3) ...

但是 依旧不行:

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.

解决:

  • 安装DKMS(Dynamic Kernel ModuleSupport)
sudo apt-get install dkms

通过
cd /usr/src
ls
查看对应安装的驱动版本

Linux nvidia 报错(1):nvidia-smi: command not found_第1张图片
上图中最下面一行显示当前驱动版本为nvidia-418-418.56

  • 重新生成对应nvidia的驱动模块
 sudo dkms install -m nvidia -v 418-418.56

结果显示成功,
然后再执行nvidia-smi还是不行啊!但是我突然注意到上面的重启提醒:
Linux nvidia 报错(1):nvidia-smi: command not found_第2张图片遂重启:sudo reboot
最后尝试:还是失败,感觉应该是上面 nvidia 版本安装错了吧??
是不是应该尝试一下别的?
Linux nvidia 报错(1):nvidia-smi: command not found_第3张图片

3. 终结:VMware虚拟机上不能使用CUDA/CUDNN

折腾了半天,才发现虚拟机的显卡是虚拟的,不能使用CUDA

关于虚拟机相关的知识点:Linux:服务器、虚拟机、物理机?

参考:

  1. https://askubuntu.com/questions/902636/nvidia-smi-command-not-found-ubuntu-16-04
  2. ubuntu nvidia-smi命令not found
  3. nvidia-smi报错:NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver.
  4. VMware虚拟机上不能使用CUDA/CUDNN

你可能感兴趣的:(Linux/Mac)