配置不同版本软件包优先级

  1. 为不同版本建立配置
$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
  1. 使用时动态选择
$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

posted @ 2022-09-17 12:12  沐多  阅读(44)  评论(0编辑  收藏  举报