centOS卸载Python后重装

python

1.删除已有的Python

#rpm -qa|grep python|xargs rpm -ev --allmatches --nodeps

#whereis python |xargs rm -frv

#whereis python

 

 2.删除已有的yum

#rpm -qa|grep yum|xargs rpm -ev --allmatches --nodeps

#whereis yum |xargs rm -frv

 

 3. 创建两个目录用于存放Python和yum的rpm包

#mkdir /usr/local/src/python

#mkdir /usr/local/src/yum

 

 4. 查到centOS的版本并下载相应的rpm包

#cat /etc/redhat-release 

 

 对应的rpm包下载网址:http://mirrors.ustc.edu.cn/centos/7.7.1908/os/x86_64/Packages/

http://mirrors.ustc.edu.cn/centos/7.7.1908/os/x86_64/Packages/python-2.7.5-86.el7.x86_64.rpm
http://mirrors.ustc.edu.cn/centos/7.7.1908/os/x86_64/Packages/python-devel-2.7.5-86.el7.x86_64.rpm
http://mirrors.ustc.edu.cn/centos/7.7.1908/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
http://mirrors.ustc.edu.cn/centos/7.7.1908/os/x86_64/Packages/python-pycurl-7.19.0-19.el7.x86_64.rpm
http://mirrors.ustc.edu.cn/centos/7.7.1908/os/x86_64/Packages/python-setuptools-0.9.8-7.el7.noarch.rpm
http://mirrors.ustc.edu.cn/centos/7.7.1908/os/x86_64/Packages/python-libs-2.7.5-86.el7.x86_64.rpm
http://mirrors.ustc.edu.cn/centos/7.7.1908/os/x86_64/Packages/python-urlgrabber-3.10-9.el7.noarch.rpm
http://mirrors.ustc.edu.cn/centos/7.7.1908/os/x86_64/Packages/rpm-python-4.11.3-40.el7.x86_64.rpm

进入到python目录下

#cd /usr/local/src/python 

将上面的rpm包下载到python目录

 

 cd /usr/local/src/yum

http://mirrors.ustc.edu.cn/centos/7.7.1908/os/x86_64/Packages/yum-3.4.3-163.el7.centos.noarch.rpm
http://mirrors.ustc.edu.cn/centos/7.7.1908/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
http://mirrors.ustc.edu.cn/centos/7.7.1908/os/x86_64/Packages/yum-utils-1.1.31-52.el7.noarch.rpm
http://mirrors.ustc.edu.cn/centos/7.7.1908/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm
http://mirrors.ustc.edu.cn/centos/7.7.1908/os/x86_64/Packages/yum-plugin-protectbase-1.1.31-52.el7.noarch.rpm
http://mirrors.ustc.edu.cn/centos/7.7.1908/os/x86_64/Packages/yum-plugin-aliases-1.1.31-52.el7.noarch.rpm

 

5.安装python

#rpm -ivh python-* rpm-python-*

 

 出现上面依赖包的解决方法:

#rpm -ivh python-*   rpm-python-* --nodeps --force

 

 输入#python 查看Python是否按照成功

 

 

6. 安装yum

#cd /usr/local/src/yum

#rpm -ivh yum-* --nodeps --force

 

 

 

 

以上是 centOS卸载Python后重装 的全部内容, 来源链接: utcz.com/z/389489.html

回到顶部