CentOS7 如何安裝python3.8

工作需要使用Python3.8以上版本。因此需要卸載系統(tǒng)之前其他版本的 Python。以下就是我卸載其他版本,安裝 Python3.8 版本步驟。

  • 一、卸載Python3.6
// 查看版本 
[root@localhost ~]#python -v
image.png
// 查找 Python 文件所在路徑
[root@localhost ~]# whereis python
// 卸載刪除 Python
[root@localhost ~]# rpm -qa|grep python3*|xargs rpm -ev --allmatches --nodeps
image.png
// 檢測是否卸載刪除干凈
[root@localhost ~]# python
image.png
// 解壓縮
[root@localhost ~]# tar -xvf Python-3.8.7.tgz
image.png
// 執(zhí)行安裝
// 運行腳本configure
[root@localhost ~]# cd Python-3.8.7
 
[root@localhost Python-3.8.7]# ./configure --prefix=/usr/local/python3

// make編譯&make install安裝
[root@localhost Python-3.8.7]#  make && make altinstall

// 運行make clean

// 刪除一些臨時文件 
[root@localhost Python-3.8.7]#  make clean

// 創(chuàng)建軟鏈接
// ln -s -f 強制創(chuàng)建軟連接
[root@localhost local] ln -s /usr/local/python3/bin/python3.8 /usr/bin/python3
 
[root@localhost local] ln -s /usr/local/python3/bin/pip3.8 /usr/bin/pip3
image.png
// 檢測安裝是否成功
[root@localhost ~]# python3 -V
image.png
最后編輯于
?著作權歸作者所有,轉載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內(nèi)容