参考链接 https://blog.csdn.net/qq_43030766/article/details/91382868

首先我的系统是ubuntu1804 

ly@ubuntu18:~$ uname -a
Linux ubuntu18 5.0.0-29-generic #31~18.04.1-Ubuntu SMP Thu Sep 12 18:29:21 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

查看显卡设备,用grep -i nvidia筛选出带nvidia的行(-i参数表示忽略大小写)

ly@ubuntu18:~$ lspci |grep -i nvidia
01:00.0 VGA compatible controller: NVIDIA Corporation GP106 [GeForce GTX 1060 6GB] (rev a1)
01:00.1 Audio device: NVIDIA Corporation GP106 High Definition Audio Controller (rev a1)

检测N卡型号和推荐的驱动型号,可以看到推荐nvidia-driver-430(recommended:推荐的)

ly@ubuntu18:~$ ubuntu-drivers devices
== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
modalias : pci:v000010DEd00001C03sv00007377sd00000000bc03sc00i00
vendor   : NVIDIA Corporation
model    : GP106 [GeForce GTX 1060 6GB]
driver   : nvidia-driver-430 - distro non-free recommended
driver   : nvidia-driver-390 - distro non-free
driver   : xserver-xorg-video-nouveau - distro free builtin

执行命令,安装推荐驱动nvidia-driver-430

y@ubuntu18:~$ sudo apt-get install nvidia-driver-430

省事一点就直接自动安装推荐的显卡驱动

ly@ubuntu18:~$ sudo ubuntu-drivers autoinstall

安装完成后执行nvidia-smi并不能查看到显卡驱动的信息,必须重启后再执行nvidia-smi命令才能查看到驱动信息

ly@ubuntu18:~$ nvidia-smi
Sat Sep 28 01:11:18 2019       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 430.26       Driver Version: 430.26       CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 106...  Off  | 00000000:01:00.0  On |                  N/A |
| 49%   47C    P0    30W / 130W |    352MiB /  6075MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1170      G   /usr/lib/xorg/Xorg                            18MiB |
|    0      1204      G   /usr/bin/gnome-shell                          48MiB |
|    0      1466      G   /usr/lib/xorg/Xorg                           138MiB |
|    0      1595      G   /usr/bin/gnome-shell                          92MiB |
|    0      6241      G   ...quest-channel-token=6282166937601878431    51MiB |
+-----------------------------------------------------------------------------+

Logo

更多推荐