欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

ubuntu?20.04系統(tǒng)下如何切換gcc/g++/python的版本

 更新時間:2023年12月05日 08:24:53   作者:田園詩人之園  
這篇文章主要給大家介紹了關(guān)于ubuntu?20.04系統(tǒng)下如何切換gcc/g++/python版本的相關(guān)資料,文中通過代碼介紹的非常詳細,對大家學習或者使用ubuntu具有一定的參考借鑒價值,需要的朋友可以參考下

前言

當系統(tǒng)同時存在gcc-9以及gcc-10時該如何切換讓當前的系統(tǒng)gcc版本指向gcc-9或是gcc-10呢?g++也同樣如此。

面臨更嚴重問題的python更是如此,ubuntu 目前默認安裝的python版本是2.7,而我們經(jīng)常使用的版本為3.xx。

1 安裝gcc/g++/python

同時安裝gcc/g+±9,gcc/g+±10,python2/3

sudo apt-get install update

sudo apt install gcc-9
sudo apt install g++-9

sudo apt install gcc-10
sudo apt install g++-10

sudo apt install python
sudo apt install python3

2 設(shè)置gcc/g++/python的備選項

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10

sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 9
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 2

3 選擇當前系統(tǒng)要使用的gcc/g++/python版本

3.1 切換gcc/g++/python版本

sudo update-alternatives --config gcc
sudo update-alternatives --config g++
sudo update-alternatives --config python

3.2 切換示例

以gcc為例

$ sudo update-alternatives --config gcc
[sudo] password for test: 
There are 2 choices for the alternative gcc (providing /usr/bin/gcc).

  Selection    Path             Priority   Status
------------------------------------------------------------
  0            /usr/bin/gcc-10   10        auto mode
* 1            /usr/bin/gcc-10   10        manual mode
  2            /usr/bin/gcc-9    9         manual mode

Press <enter> to keep the current choice[*], or type selection number: 0
$

總結(jié) 

到此這篇關(guān)于ubuntu 20.04系統(tǒng)下切換gcc/g++/python版本的文章就介紹到這了,更多相關(guān)ubuntu切換gcc/g++/python版本內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論