配置不同版本软件包优先级
- 为不同版本建立配置
$sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 60
$sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 70
- 使用时动态选择
$sudo update-alternatives --config gcc
There are 2 choices for the alternative gcc (providing /usr/bin/gcc).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/gcc-9 70 auto mode
1 /usr/bin/gcc-8 30 manual mode
2 /usr/bin/gcc-9 70 manual mode