將 Ubuntu 16 和 18 上的 python 升級到最新 python3.8 的方法教程
1. 概述
本文記錄在 Ubuntu 16.04 上將 python 升級為 3.8 版本,并配置為系統(tǒng)默認(rèn) python3 的過程。
在 Ubuntu 16.04 中,python3 的默認(rèn)版本為 3.5:
$ python3 -V
Python 3.5.2
本文以在 Ubuntu 16.04 中安裝為例,方法同樣適用于 Ubuntu 18.04 。
2. 通過 Apt 安裝
Ubuntu 官方 apt 庫中還未收錄 python 3.8,這里使用 deadsnakes PPA 庫安裝。
2.1. 安裝依賴包
$ sudo apt update $ sudo apt install software-properties-common
2.2. 添加 deadsnakes PPA 源
$ sudo add-apt-repository ppa:deadsnakes/ppa
Press [ENTER] to continue or Ctrl-c to cancel adding it.
2.3. 安裝 python 3.8
$ sudo apt install python3.8
$ python3.8 -V
Python 3.8.2
3. 配置 python3.8 為系統(tǒng)默認(rèn) python3
3.1. 將 python 各版本添加到 update-alternatives
$ which python3.8 /usr/bin/python3.8 $ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1 $ which python3.5 /usr/bin/python3.5 $ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 2
3.2. 配置 python3 默認(rèn)指向 python3.8
$ sudo update-alternatives --config python3 There are 2 choices for the alternative python3 (providing /usr/bin/python3). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/bin/python3.5 2 auto mode 1 /usr/bin/python3.5 2 manual mode 2 /usr/bin/python3.8 1 manual mode Press <enter> to keep the current choice[*], or type selection number: 2
選擇/輸入 2, 回車。
3.3 測試 python 版本
$ python3 -V
Python 3.8.2
資源
How to Install Python 3.8 on Ubuntu 18.04
How to upgrade to python 3.7 on Ubuntu 18.10
總結(jié)
到此這篇關(guān)于將 Ubuntu 16 和 18 上的 python 升級到最新 python3.8 的方法教程的文章就介紹到這了,更多相關(guān) Ubuntu 16 和 18 升級到python 3.8 內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
python3使用logging包,如何把日志寫到系統(tǒng)的rsyslog中
這篇文章主要介紹了python3使用logging包,如何把日志寫到系統(tǒng)的rsyslog中的問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2023-09-09
基于Django的樂觀鎖與悲觀鎖解決訂單并發(fā)問題詳解
這篇文章主要介紹了基于Django的樂觀鎖與悲觀鎖解決訂單并發(fā)問題詳解,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下2019-07-07

