Ubuntu下安裝卸載python3.8的過(guò)程
一、Python 3.8 安裝
在 Ubuntu 16.04 中,python3 的默認(rèn)版本為 3.5:
$ python3 -V Python 3.5.2
本文以在 Ubuntu 16.04 中安裝為例,方法同樣適用于 Ubuntu 18.04 。
1.通過(guò) Apt 安裝Python3.8
Ubuntu 官方 apt 庫(kù)中還未收錄 python 3.8,這里使用 deadsnakes PPA 庫(kù)安裝。
1.1. 安裝依賴包
$ sudo apt-get update $ sudo apt-get install software-properties-common
1.2. 添加 deadsnakes PPA 源
$ sudo add-apt-repository ppa:deadsnakes/ppa Press [ENTER] to continue or Ctrl-c to cancel adding it.
1.3. 安裝 python 3.8
$ sudo apt-get update $ sudo apt-get install python3.8 $ python3.8 -V Python 3.8.2
2.配置 python3.8 為系統(tǒng)默認(rèn) python3
修改默認(rèn) python3 會(huì)導(dǎo)致打不開(kāi) Terminal 等各種問(wèn)題,建議不要修改。解決方法見(jiàn) Ubuntu16.04TLS 中終端(Terminal)無(wú)法打開(kāi)的解決辦法
2.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
2.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 PriorityStatus ------------------------------------------------------------ * 0/usr/bin/python3.52auto mode 1/usr/bin/python3.52manual mode 2/usr/bin/python3.81manual mode Press <enter> to keep the current choice[*], or type selection number: 2
選擇/輸入 2, 回車。
2.3 測(cè)試 python 版本
$ python3 -V Python 3.8.2
二、卸載python3.8
1、卸載python3.8
sudo apt-get remove python3.8
2、卸載python3.8及其依賴
sudo apt-get remove --auto-remove python3.8
3、清除python3.8
sudo apt-get purge python3.8 or sudo apt-get purge --auto-remove python3.8
注釋:
此方法卸載python比較徹底,所以適合更換python版本時(shí)使用。
——對(duì)于既想完全卸載python,又無(wú)法接受完全卸載后某些python組件無(wú)法使用的童鞋,請(qǐng)慎重!
參考鏈接:
[1] 如何將 Ubuntu 16 和 18 上的 python 升級(jí)到最新 3.8 版
[2] Ubuntu安裝Python3 和卸載
到此這篇關(guān)于Ubuntu下python3.8的安裝與卸載的文章就介紹到這了,更多相關(guān)Ubuntu python3.8安裝卸載內(nèi)容請(qǐng)搜索本站以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持本站!
版權(quán)聲明:本站文章來(lái)源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請(qǐng)保持原文完整并注明來(lái)源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來(lái)源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來(lái),僅供學(xué)習(xí)參考,不代表本站立場(chǎng),如有內(nèi)容涉嫌侵權(quán),請(qǐng)聯(lián)系alex-e#qq.com處理。