ubuntu安装nvidia显卡驱动提示An error occurred while performing the step: “Building kernel modules“.

错误提示:

ERROR An error occurred while performing the step: "Building kernel modules". See /var/log/nvidia-installer.log for details. 
ERROR: The nvidia kernel module was not created.
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.

错误图下图:
在这里插入图片描述

通过检查/var/log/nvidia-installer.log文件发现,其中930行到940行说了错误的原因是gcc版本不匹配
在这里插入图片描述
使用gcc -v指令查看当前系统中gcc的版本,可以发现确实是gcc-11,那么接下来就安装gcc-12
在这里插入图片描述

使用指令

sudo apt install gcc-12

来安装gcc-12
安装好后使用gcc -v会发现gcc版本没切换过来,一定要手动切换,参考这篇Ubuntu 切换GCC版本来切换gcc版本即可

切换完后大功告成

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值