Linux删除系统自带版本Python过程详解
作者:Mr_伍先生 时间:2023-10-21 03:12:13
巨坑,切忌不要轻易删除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
来源:https://www.cnblogs.com/mr-wuxiansheng/p/12878578.html
标签:Linux,删除,Python
0
投稿
猜你喜欢
Golang中 Slice的分析与使用源码解析
2023-06-19 03:48:13
python识别验证码图片实例详解
2022-02-13 10:23:53
MYSQL的binary解决mysql数据大小写敏感问题的方法
2024-01-25 16:38:26
Python文件及目录操作实例详解
2023-11-26 12:50:27
python操作jira添加模块的方法
2022-01-20 12:41:42
SQLServer触发器调用JavaWeb接口的过程详解
2024-01-17 12:08:45
Java如何连接数据库图文教程
2024-01-16 20:45:16
浅谈Python如何获取excel数据
2021-04-06 09:30:32
python web框架学习笔记
2022-09-30 07:46:38
MSSQL数据类型
2008-08-03 17:21:00
Python实现的json文件读取及中文乱码显示问题解决方法
2022-05-18 16:41:15
SQL Server的链接服务器技术小结
2024-01-17 03:41:22
python脚本作为Windows服务启动代码详解
2021-09-11 00:09:26
SQL列名无效 sql查询列名 sql返回列名
2009-09-03 13:19:00
Python使用django获取用户IP地址的方法
2021-07-22 04:01:05
mysql 8.0.12 安装图文教程
2024-01-28 05:19:04
PyCharm代码格式调整方法
2021-05-21 14:59:32
如何实现更换Jupyter Notebook内核Python版本
2022-11-22 19:41:09
Python IDLE清空窗口的实例
2023-11-22 17:59:23
将pymysql获取到的数据类型是tuple转化为pandas方式
2024-01-26 11:26:18