CentOS 卸载 python

[复制链接]
发表于 2020-9-1 09:39:00 | 显示全部楼层 |阅读模式

卸载 python 2.7

rpm -qa|grep python2|xargs rpm -ev --allmatches --nodeps

whereis python2 |xargs rm -frv

-------------------

卸载 python3
rpm -qa|grep python3|xargs rpm -ev --allmatches --nodeps       卸载pyhton3
whereis python3 |xargs rm -frv           删除所有残余文件
成功卸载!
whereis   python       查看现有安装的python

 -------------------

The system python on CentOS 7 must be the 2.7 version that we ship. Must. 
You cannot replace the system python with a different one.
If you need a newer python then multiple places ship a python3 stack that installs in parallel to the system 2.7 that we ship.
No-one yet ships 3.8 as it's too new. There are python 3.6 packages in the CentOS 7.7 base and updates repos.
Use those.
They are supported and are the same versions that are in CentOS 8 so you know things written on one should work on the other.

 -------------------

Centos 7.8

Python 3 is now available. Installing the python3 package gives you the Python 3.6 interpreter。Python 3 可用,安装python3将会提供Python 3.6解释器。

---------------------------------

Centos 8

Python 3.6 是默认的 Python 环境,有限支持 Python 2.7

---------------------------------





来源:https://www.cnblogs.com/emanlee/p/13594389.html
回复

使用道具 举报

发表于 2026-10-10 21:03:21 | 显示全部楼层
友情提示一下哈,卸载系统Python要谨慎!

看到你想在CentOS上卸载Python,个人建议你三思而行哈。CentOS的系统很多关键组件(比如yum)都是依赖系统Python的,如果盲目卸载可能会导致系统崩溃,到时候就麻烦大了。

如果真的需要:
其实真没必要完全卸载系统Python,你可以选择安装多个Python版本来共存嘛。

更安全的做法:


  • CentOS 7:直接安装Python3.6就好啦,命令是
    1. yum install python3
    复制代码
    ,这样系统和Python3可以共存
  • CentOS 8:系统本身就已经内置Python 3.6了,直接用就行
  • 想要更新版本:可以用pyenv或者conda来管理多版本,完全没必要动系统Python


血的教训:之前有人手贱把系统Python卸了,结果yum都用不了了,只能重装系统,得不偿失啊!

如果你是想用新版本Python,完全可以走上面说的共存方案,既安全又方便,何必非要赶尽杀绝呢?你说是不是这个理?

有啥其他问题欢迎继续讨论哈,大家一起进步!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

圆梦公社,专注于为全球华人提供纯粹技术交流的地方,请勿发布任何政治及违法的言论。如有相关侵权、举报、投诉及建议等,请发 E-mail:dzh188@hotmail.com

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部