当前位置:   article > 正文

nvidia-smi失效:NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver_the major and minor number of the compiler used to

the major and minor number of the compiler used to compile the kernel: x86_6

1.显卡驱动失效

nvidia-smi命令失效,显示NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver
驱动崩了,重新安装驱动即可
先找到之前安装的nvidia驱动版本号

ls /usr/src | grep nvidia
  • 1

然后对应安装

sudo apt install dkms
sudo dkms install -m nvidia -v 418.87.00#这里的数字替换成查找到的nvidia版本号
  • 1
  • 2

2.继续报错,安装失败

安装未成功,报错显示

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area...
'make' -j32 NV_EXCLUDE_BUILD_MODULES='' KERNEL_UNAME=5.4.0-91-generic IGNORE_CC_MISMATCH='' modules...(bad exit status: 2)
ERROR (dkms apport): binary package for nvidia: 450.80.02 not found
Error! Bad return status for module build on kernel: 5.4.0-91-generic (x86_64)
Consult /var/lib/dkms/nvidia/450.80.02/build/make.log for more information.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

即编译出错,点击make.log查看

Compiler version check failed:

The major and minor number of the compiler used to
compile the kernel:

gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)

does not match the compiler used here:

cc (Ubuntu 8.4.0-1ubuntu1~18.04) 8.4.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

搜索网上其他博客,大致的问题一致,都是编译要求的gcc版本和当前版本不一致导致。
解决方法即为重新安装合适版本的gcc
其他博客的解决方法:
https://blog.csdn.net/hizengbiao/article/details/103698560
https://www.cnblogs.com/zzc-Andy/p/15069673.html?ivk_sa=1024320u
我的安装gcc的方法如下

sudo apt-get update
sudo apt-get install gcc-7
sudo apt-get install g++-7
cd /usr/bin
sudo rm gcc g++
sudo ln -s gcc-7 gcc
sudo ln -s g++-7 g++
gcc -v#查看安装版本是否成功
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

然后再按照第一节的命令重新安装驱动即可

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/凡人多烦事01/article/detail/260130
推荐阅读
相关标签
  

闽ICP备14008679号