1. 程式人生 > 其它 >Ubuntu 16.04安裝python3.6 並切換為 python3.6

Ubuntu 16.04安裝python3.6 並切換為 python3.6

技術標籤:pythonubuntupython

ubuntu預設自帶python2.7與3.5

很多時候需要更高的版本來支援我們進行一些操作

1. python3.6 安裝:

  • 1.1下載安裝包
wget http://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
  • 1.2 解壓
tar -xvzf Python-3.6.4.tgz
  • 1.3 依次執行
cd Python-3.6.4
./configure --with-ssl
make
sudo make install

2.切換預設python版本

  • 2.1 檢視當前python版本軟連結
which
python
  • 2.2 進入其路徑,刪除預設連結
sudo rm python
  • 2.3 找到python3.6所在位置
which python3.6
  • 2.4 新增軟連結至python3.6,使3.6版本為當前預設版本
sudo ln -s /usr/local/bin/python3.6  /usr/bin/python