Docker下的ubuntu 安裝python3.6 及pip3

直接安裝 apt-get install python3.6 ,失敗

root@91d2d47e8aee:/# apt-get install python3.6                  
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package python3.6
E: Couldn't find any package by glob 'python3.6'
E: Couldn't find any package by regex 'python3.6'

參考Ubuntu怎樣安裝Python3.6

繼續(xù)安裝:

步驟1:添加ppa到系統(tǒng)

什么是ppa

add-apt-repository ppa:jonathonf/python-3.6 
失敗,問題:add-apt-repository找不到  

解決辦法:

執(zhí)行下面兩個步驟:

apt-get install python-software-properties  
apt-get install software-properties-common

Ubuntu無法找到add-apt-repository問題的解決方法

重復(fù)步驟1:

add-apt-repository ppa:jonathonf/python-3.6

步驟2 更新:

apt-get update

步驟3 安裝:

apt-get install python3.6

安裝完成?。?/p>

修改python命令默認(rèn)python3.6:

ubuntu默認(rèn)安裝了python2.7,輸入python 、 python3、 python3.6依次得到如下版本:


修改python命令默認(rèn)python3.6

步驟1: 查看python命令指向:

ls -l /usr/bin | grep python 

可以看到python命令指向python2.7版本

步驟2: 刪除原有python軟連接

rm /usr/bin/python 

步驟3: 建立python到python3.6新的軟鏈接

ln -s /usr/bin/python3.6 /usr/bin/python 

ubuntu 安裝pip

直接安裝python3版本pip

apt-get install python3-pip

安裝完成后,建立pip到pip3的軟連接。

ln -s /usr/bin/pip3 /usr/bin/pip 
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容