GCC版本切换
update-alternatives --config gcc
$ update-alternatives --config gccThere is only one alternative in link group gcc (providing /usr/bin/gcc): /usr/bin/gcc-9Nothing to configure.
sudo update-alternatives --install needs <link> <name> <path> <priority>
$ sudo update-alternatives --install /usr/bin/gcc gcc /home/linuxbrew/.linuxbrew/Cellar/gcc/11.2.0_2/bin/gcc-11 100$ sudo update-alternatives --install /usr/bin/g++ g++ /home/linuxbrew/.linuxbrew/Cellar/gcc/11.2.0_2/bin/g++-11 100
$ gcc -v-bash: /usr/bin/gcc: Is a directory
update-alternatives --config gccThere are 2 choices for the alternative gcc (providing /usr/bin/gcc).Selection Path Priority Status------------------------------------------------------------* 0 /home/linuxbrew/.linuxbrew/Cellar/gcc/11.2.0_2/bin/gcc-11 100 auto mode1 /home/linuxbrew/.linuxbrew/Cellar/gcc/11.2.0_2/bin/gcc-11 100 manual mode2 /usr/bin/gcc-9 40 manual modePress <enter> to keep the current choice[*], or type selection number:
sudo update-alternatives --remove <name> <path>
$ sudo update-alternatives --remove gcc /home/linuxbrew/.linuxbrew/Cellar/gcc/
