1. 程式人生 > 其它 >Ubuntu16.04安裝python3.6

Ubuntu16.04安裝python3.6

技術標籤:ubuntupythonubuntulinux

1.檢視當前python版本
Ubuntu16.04預設安裝了Python2.7和3.5
請注意,系統自帶的python千萬不能解除安裝!
輸入命令python
在這裡插入圖片描述
按Ctrl+D退出python命令列
2.輸入命令

wget http://www.python.org/ftp/python/3.6.6/Python-3.6.6.tgz
tar -xvzf Python-3.6.6.tgz
cd Python-3.6.6
./configure --prefix=/usr/bin/python3.6
make
sudo make install

3.輸入python,此時預設還是2版本,需要調整一下順序

在這裡插入圖片描述

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150

參考連結


解決方法