ubuntu22.10 install cuda error Failed to verify gcc version. See log at /var/log/cuda-installer.log for details.

ubuntu22.10 is installing cuda, use the following command:

sudo sh cuda_11.0.2_450.51.05_linux.run

    The result is an error message: Failed to verify gcc version. See log at /var/log/cuda-installer.log for details.

1. This is due to the mismatch of gcc versions! The general easy solution is to ignore and use the --override parameter

sudo sh cuda_11.0.2_450.51.05_linux.run --override

 2. Or you can change the gcc version,

  A. When selecting the CUDA version, you can see "Versioned Online Documentation" at the end of the link, as shown in the figure below:

B. Enter the link, and you can see "Installation Guide Linux" under "Installation Guides". After entering, you can see the gcc version corresponding to cuda, as shown in the figure below:

 

 C. Install the corresponding gcc version

###安装需要的gcc版本,查看表格,发现需要11.2版本
### 输入 sudo apt install gcc-11.2时产生错误,结果用下面命令,可以安装

sudo apt install gcc-11


### 因为安装的是11版本,也不知是11.*.*哪个版本,所以,输入如下命令查看,
              后面发现安装的是11.3.0版本

sudo dpkg -l | grep gcc

D. Change the gcc version

####末尾那个20代表全重,可以10、20、30、40。。。

update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11.3.0 20

###更改完可以查一下更改结果

gcc --version

###得到如下结果,完成

lanpo@lanpo:~$ gcc --version
gcc (Ubuntu 11.3.0-6ubuntu1) 11.3.0

Guess you like

Origin blog.csdn.net/aizsa111/article/details/129455363