將 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)文章
Python GUI編程學(xué)習(xí)筆記之tkinter控件的介紹及基本使用方法詳解
這篇文章主要介紹了Python GUI編程學(xué)習(xí)筆記之tkinter控件的介紹及基本使用方法,結(jié)合實例形式詳細(xì)分析了Python GUI編程中tkinter控件的原理、用法及相關(guān)操作注意事項,需要的朋友可以參考下2020-03-03在Python中利用Into包整潔地進(jìn)行數(shù)據(jù)遷移的教程
這篇文章主要介紹了在Python中如何利用Into包整潔地進(jìn)行數(shù)據(jù)遷移,在數(shù)據(jù)格式的任意兩個格式之間高效地遷移數(shù)據(jù),需要的朋友可以參考下2015-03-03Python實現(xiàn)Matplotlib,Seaborn動態(tài)數(shù)據(jù)圖的示例代碼
這篇文章主要為大家詳細(xì)介紹了如何讓Matplotlib、Seaborn的靜態(tài)數(shù)據(jù)圖動起來,變得栩栩如生。文中的示例代碼講解詳細(xì),感興趣的小伙伴可以學(xué)習(xí)一下2022-05-05關(guān)于tensorflow中tf.keras.models.Sequential()的用法
這篇文章主要介紹了關(guān)于tensorflow中tf.keras.models.Sequential()的用法,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2024-01-01Pytorch卷積神經(jīng)網(wǎng)絡(luò)resent網(wǎng)絡(luò)實踐
這篇文章主要為大家介紹了Pytorch卷積神經(jīng)網(wǎng)絡(luò)resent網(wǎng)絡(luò)實踐,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-05-05Python+Pika+RabbitMQ環(huán)境部署及實現(xiàn)工作隊列的實例教程
RabbitMQ是一個消息隊列服務(wù)器,在本文中我們將學(xué)習(xí)到Python+Pika+RabbitMQ環(huán)境部署及實現(xiàn)工作隊列的實例教程,需要的朋友可以參考下2016-06-06Python采集C站熱榜數(shù)據(jù)實戰(zhàn)示例
這篇文章主要為大家介紹了Python采集C站熱榜數(shù)據(jù)實戰(zhàn)示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-05-05Pandas索引排序 df.sort_index()的實現(xiàn)
本文主要介紹了Pandas索引排序 df.sort_index()的實現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2022-07-07