Centos7下进行python2.6和yum完全卸载及重装

本文详细介绍了如何在Centos7系统中卸载Python2.6和yum,以及如何从指定源下载相应版本的rpm包进行重新安装。关键步骤包括删除现有Python和yum,创建存放rpm包的目录,以及按照特定顺序安装python和yum的多个依赖包。
摘要由CSDN通过智能技术生成

Centos7下进行python2.6和yum完全卸载及重装

1、删除现有Python

#rpm -qa|grep python|xargs rpm -ev --allmatches --nodeps ##强制删除已安装程序及其关联
#whereis python |xargs rm -frv ##删除所有残余文件 ##xargs,允许你对输出执行其他某些命令
#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.下载相应的包并进行安装

(注意:在下载相应的包的时候一定要和系统的版本号对应,可以用:
[root@localhost ~]# cat /etc/redhat-release查看自己系统的版本号
这里我的系统版本为:Red Hat Enterprise Linux Server release 7.6 (Maipo))

(1)安装python
1)下载python的rpm包
934909504: found 24 primes in [30000080, 30000279] Thread 123145942302208: found 24 primes in [30000140, 30000339] Thread 123145934909504: found 25 primes in [30000060, 30000259] Thread 123145942302208: found 24 primes in [30000020, 30000219在 CentOS 7 中,yum 和很多系统工具都是基于 Python 2.x 版本开发的,如果你] Thread 123145934909504: found 24 primes in [30000110, 30000309] Thread 123145942卸载Python 2.x 版本,那么会导致 yum 无法正常使用。为了解决这个302208: found 25 primes in [30000170, 30000369] Thread 123145934909504: found 24问题,你需要重新安装 Python 2.x 版本或者升级到 Python 3.x 版本。 如果你想重新 primes in [30000050, 30000249] Thread 123145942302208: found 24 primes in [30000120安装 Python 2.x 版本,可以使用以下命令: ``` sudo yum install python2 ``` 如果你想升, 30000319] Thread 123145934909504: found 25 primes in [30000090, 30000289] 级到 Python 3.x 版本,可以使用以下命令: ``` sudo yum install python3 ``` 安装完成后Thread 123145942302208: found 24 primes in [30000030, 30000229] Thread 123145934909,你需要将系统默认的 Python 版本切换到新安装的版本,可以使用以下命令: ``` sudo alternatives504: found 24 primes in [30000100, 30000299] Thread 123145942302208: found 25 primes --config python ``` 然后选择你要使用的 Python 版本即可。 另外,为了避免类似的 in [30000160, 30000359] Thread 123145934909504: found 24 primes in [30000080,问题发生,建议不要轻易卸载系统自带的 Python 版本,可以通过安装其他版本的 Python 来 30000279] Thread 123145942302208: found 24 primes in [30000140, 30000339] Thread满足自己的需求。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值