Ubuntu默認已經安裝了Python的版本了,不過是Python2的版本。
我們安裝好Python3想把他切換為系統默認的版本。
sudo update-alternatives --config python
//顯示當前系統中所有的Python版本。
直接輸入數字,即可切換為相應的版本號。
這樣你甚至可以將自己喜歡的任意版本python安裝到任意位置,然后使用update-alternatives
將其設置為系統默認python。
同時,也可使用下面的命令來切換
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150