nvidia-smi失效:NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver

1.显卡驱动失效

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

ls /usr/src | grep nvidia

然后对应安装

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

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.

即编译出错,点击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

搜索网上其他博客,大致的问题一致,都是编译要求的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
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值