ubuntu16.04自帶python有兩個(gè)版本,一個(gè)2版本,使用的是python;另一個(gè)是3版本,使用的是python3。
簡(jiǎn)易安裝python后得到的3版本的版本號(hào)是python3.5。
可以使用下面的命令查看py版本:
1
|
python3 - - version |
因?yàn)榘姹緝?nèi)容/接口等的不同,需要將其升級(jí)到更高的版本操作如下:
1、安裝Python3.7
1
|
sudo apt-get install python3.7 |
2、為了方便使用,建議創(chuàng)建軟連接
首先把之前的軟連接刪除:
1
2
|
sudo rm -rf /usr/bin/python3 sudo rm -rf /usr/bin/pip3 |
查看Python3.7安裝路徑:
1
2
|
which python3. 7 #假設(shè)返回路徑為path |
然后創(chuàng)建新的軟連接:
1
2
3
4
5
6
|
#添加python3的軟鏈接 sudo ln - s Python3. 7 安裝路徑 / python3. 7 / usr / bin / python3 #添加 pip3 的軟鏈接 sudo ln - s Python3. 7 安裝路徑 / pip3. 7 / usr / bin / pip3 #測(cè)試是否安裝成功了 python3 - - version |
這種方法也可以修改默認(rèn)Python指向的Python版本
到此這篇關(guān)于ubuntu16.04升級(jí)Python3.5到Python3.7的方法步驟的文章就介紹到這了,更多相關(guān)Python3.5升級(jí)到Python3.7內(nèi)容請(qǐng)搜索服務(wù)器之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持服務(wù)器之家!
原文鏈接:https://blog.csdn.net/danerer/article/details/85343909