您好,登錄后才能下訂單哦!
這篇文章主要介紹“Linux刪除系統自帶版本Python的方法”,在日常操作中,相信很多人在Linux刪除系統自帶版本Python的方法問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”Linux刪除系統自帶版本Python的方法”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!
1.卸載python(防止未卸載干凈)
rpm -qa|grep python|xargs rpm -ev --allmatches --nodeps #強制刪除已安裝程序及其關聯
whereis python|xargs rm -frv #刪除所有殘余文件 #xargs,允許你對輸出執行其他某些命令
2.卸載yum
rpm -qa|grep yum|xargs rpm -ev --allmatches --nodeps
rm -rf /etc/yum.repos.d/*
whereis yum|xargs rm -frv
3.驗證是否刪除干凈
whereis python #驗證刪除,應該是沒有結果返回
whereis yum
4.安裝python和yum
軟件下載地址(我這里系統是centos 7.5.1804)
查看linux系統版本:cat /etc/redhat-release
http://vault.centos.org/7.5.1804/os/x86_64/packages/
所需文件如下:(下載自己系統對應版本的就好)
wget http://vault.centos.org/7.5.1804/os/x86_64/packages/lvm2-python-libs-2.02.177-4.el7.x86_64.rpm wget http://vault.centos.org/7.5.1804/os/x86_64/packages/libxml2-python-2.9.1-6.el7_2.3.x86_64.rpm wget http://vault.centos.org/7.5.1804/os/x86_64/packages/python-libs-2.7.5-68.el7.x86_64.rpm wget http://vault.centos.org/7.5.1804/os/x86_64/packages/python-ipaddress-1.0.16-2.el7.noarch.rpm wget http://vault.centos.org/7.5.1804/os/x86_64/packages/python-backports-1.0-8.el7.x86_64.rpm wget http://vault.centos.org/7.5.1804/os/x86_64/packages/python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm wget http://vault.centos.org/7.5.1804/os/x86_64/packages/python-2.7.5-68.el7.x86_64.rpm wget http://vault.centos.org/7.5.1804/os/x86_64/packages/python-iniparse-0.4-9.el7.noarch.rpm wget http://vault.centos.org/7.5.1804/os/x86_64/packages/python-pycurl-7.19.0-19.el7.x86_64.rpm wget http://vault.centos.org/7.5.1804/os/x86_64/packages/python-urlgrabber-3.10-8.el7.noarch.rpm wget http://vault.centos.org/7.5.1804/os/x86_64/packages/python-setuptools-0.9.8-7.el7.noarch.rpm wget http://vault.centos.org/7.5.1804/os/x86_64/packages/python-kitchen-1.1.1-5.el7.noarch.rpm wget http://vault.centos.org/7.5.1804/os/x86_64/packages/python-chardet-2.2.1-1.el7_1.noarch.rpm<br> wget http://vault.centos.org/7.5.1804/os/x86_64/packages/rpm-python-4.11.3-32.el7.x86_64.rpm wget http://vault.centos.org/7.5.1804/os/x86_64/packages/yum-utils-1.1.31-45.el7.noarch.rpm wget http://vault.centos.org/7.5.1804/os/x86_64/packages/yum-3.4.3-158.el7.centos.noarch.rpm wget http://vault.centos.org/7.5.1804/os/x86_64/packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm wget http://vault.centos.org/7.5.1804/os/x86_64/packages/yum-plugin-aliases-1.1.31-45.el7.noarch.rpm wget http://vault.centos.org/7.5.1804/os/x86_64/packages/yum-plugin-protectbase-1.1.31-45.el7.noarch.rpm wget http://vault.centos.org/7.5.1804/os/x86_64/packages/yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm
5.上傳并安裝
我這里是或取鏈接后直接wget到一個目錄中的,直接進入目錄執行一下命令即可
rpm -uvh --replacepkgs lvm2-python-libs*.rpm --nodeps --force rpm -uvh --replacepkgs libxml2-python*.rpm --nodeps --force rpm -uvh --replacepkgs python*.rpm --nodeps --force rpm -uvh --replacepkgs rpm-python*.rpm yum*.rpm --nodeps --force
安裝成功后執行
yum
python
到此,關于“Linux刪除系統自帶版本Python的方法”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續學習更多相關知識,請繼續關注億速云網站,小編會繼續努力為大家帶來更多實用的文章!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。