安装CUDA :Toolkit: Installation Failed. Using unsupported Compiler.

As shown in the figure, the problem is that the gcc version is wrong and needs to be downgraded:
Insert picture description here
Solution:

gcc g++ downgrade

To test cuda, you need to downgrade the gcc and g++ versions (down to below 6.0).
ubuntu18.04 comes with gcc g++ 7.30
query mode:

gcc --version
g++ --version

Download the lower version of gcc g++ and set it up

sudo apt install gcc-4.8 g++-4.8 
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50 
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50   
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 70 
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 70

In this way, you can switch between the gcc and g++ versions used by the following command:

sudo update-alternatives --config g++

Insert picture description here

sudo update-alternatives --config gcc

Insert picture description here

Guess you like

Origin blog.csdn.net/sazass/article/details/110002469