一般 在Ubuntu終端輸入python 顯示的是python2.7的,但是現在python3.x支持的很多了,而且我們總是要像python3進步的。
所以我這里將python3 設置為默認的python
使用的命令主要有這兩個(alternatives機制):
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150
這時候再運行python 會顯示出默認的python的版本已經是python3了。
注意:
如果想再切回python2.7 ,可以使用命令:
sudo update-alternatives --config python