ubuntu?20.04系統(tǒng)下如何切換gcc/g++/python的版本
前言
當系統(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)文章
使用C語言來擴展Python程序和Zope服務(wù)器的教程
這篇文章主要介紹了使用C語言來擴展Python程序和Zope服務(wù)器的教程,本文來自于IBM官方網(wǎng)站技術(shù)文檔,需要的朋友可以參考下2015-04-04安裝pyhttpx解決ImportError: DLL load failed錯誤
這篇文章主要為大家介紹了安裝pyhttpx解決ImportError: DLL load failed錯誤,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2023-08-08Windows下PyCharm配置Anaconda環(huán)境(超詳細教程)
這篇文章主要介紹了Windows下PyCharm配置Anaconda環(huán)境,本文給大家分享一篇超詳細教程,通過圖文并茂的形式給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-07-07Python+OpenCV人臉識別簽到考勤系統(tǒng)實現(xiàn)(附demo)
本文主要介紹了Python+OpenCV人臉識別簽到考勤系統(tǒng)實現(xiàn),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2022-04-04python中字符串比較使用is、==和cmp()總結(jié)
在Python中比較字符串最好是使用簡單邏輯操作符,今天為大家講解一下is、==和cmp()使用總結(jié)2018-03-03深入講解Python中面向?qū)ο缶幊痰南嚓P(guān)知識
這篇文章主要介紹了深入講解Python中面向?qū)ο缶幊痰南嚓P(guān)知識,是Python入門學習中的基礎(chǔ)知識,需要的朋友可以參考下2015-05-05