centos7查看版本
cat /etc/redhat-release // 我这边是 CentOS Linux release 7.6.1810 (Core)
强制删除已安装程序及其关联
rpm -qa|grep python|xargs rpm -ev --allmatches --nodeps
删除所有残余文件 ##xargs,允许你对输出执行其他某些命令
whereis python |xargs rm -frv
验证删除,返回无结果
whereis python
python包下载到/opt/software/python/中(wget已经不能用了,页面下载的直接拷贝文件即可,也可以在其他机器上wget)
将上面的包放到/opt/software/python/下面,执行下面的命令
rpm -Uvh --replacepkgs python*.rpm
删除原有YUM
rpm -aq|grep yum|xargs rpm -e --nodeps
--force 即使覆盖属于其它包的文件也强迫安装
--nodeps 如果该RPM包的安装依赖其它包,即使其它包没装,也强迫安装。
rpm -Uvh --replacepkgs rpm-python.rpm yum.rpm --force --nodeps
将yum源配置为网易和阿里的开源镜像
备份原来的镜像源
cd /etc/yum.repos.d/
mkdir repo_bak
mv *.repo repo_bak/
下载阿里和网易源
清除系统所有的yum缓存
yum clean all
生成yum缓存
yum makecache
安装epel源
yum install -y epel-release
使用阿里开源镜像提供的epel源
再次清除系统yum缓存,并重新生成新的yum缓存
yum clean all
yum makecache
查看系统可用的yum源和所有的yum源
yum repolist enabled