ubuntu18.4 升級Python到3.8版本

walt-white發表於2021-04-09

1. 下載原始碼

wget <https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz>

2. 解壓

tar -zxvf Python-3.8.0.tgz

3. 切換目錄

cd Python-3.8.0

4 .配置安裝環境

./configure --with-ssl --prefix=/usr/local/python3

5. 安裝依賴

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential python-dev python-setuptools python-pip python-smbus libncursesw5-dev libgdbm-dev zlib1g-dev libsqlite3-dev tk-dev libssl-dev openssl libffi-dev

6. make and make install

make
sudo make install

7. 刪除軟連線

sudo rm -rf /usr/bin/python3 
sudo rm -rf /usr/bin/pip3

8. 新建軟連線

sudo ln -s /usr/local/python3/bin/python3.8 /usr/bin/python3
sudo ln -s /usr/local/python3/bin/pip3.8 /usr/bin/pip3

9. 測試是否安裝成功

python3
本作品採用《CC 協議》,轉載必須註明作者和本文連結
walt-white-zhou

相關文章