Centos7安装NVIDIA的驱动的坑

错误:
NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

ERROR: Failed to run /sbin/dkms build -m nvidia -v 430.64 -k 3.10.0-1127.13.1.el7.x86_64: Error! echo
Your kernel headers for kernel 3.10.0-1127.13.1.el7.x86_64 cannot be
found at
/lib/modules/3.10.0-1127.13.1.el7.x86_64/build or
/lib/modules/3.10.0-1127.13.1.el7.x86_64/source.
You can use the --kernelsourcedir option to tell DKMS where it’s
located

ERROR: Failed to install the kernel module through DKMS. No kernel module
was installed; please try installing again without DKMS, or check the
DKMS logs for more information.

ERROR: Installation has failed. Please see the file
‘/var/log/nvidia-installer.log’ for details. You may find
suggestions on fixing installation problems in the README available
on the Linux driver download page at www.nvidia.com.

(1)查看安装的nvidia模块命令

        rpm -qa|grep -i nvid|sort

(2)删除找到的模块

        yum  remove kmod-nvidia-390.87-1.el7_5.elrepo.x86_64  xorg-x11-drv-nvidia-384.81-1.el7.x86_64yum search  kmod-nvidia   nvidia-kmod-384.81-2.el7.x86_64

 注释:如果有错误提示“NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver”需要运行nvidia-uninstall

(3)安装显卡检测程序

       rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm  

       yum install nvidia-detect  

(4)运行 nvidia-detect

      结果:kmod-nvidia

(5)安装基础包 yum install kernel-devel kernel-doc kernel-headers gcc* glibc* glibc-*

(6)安装刚才检测到的驱动 yum install kmod-nvidia
(7)然后查看显卡(命令:nvidia-smi)中进程的使用情况。

参考:https://blog.csdn.net/lwhsyit/article/details/82774438

你可能感兴趣的:(Linux)