CentOS 卸载 python
<p><strong>卸载 python 2.7</strong></p><p><code>rpm -qa|grep python2|xargs rpm -ev --allmatches --nodeps</code></p>
<p><code>whereis python2 |xargs rm -frv</code></p>
<p>-------------------</p>
<pre class="hljs vim mCustomScrollbar _mCS_11 mCS-autoHide mCS_no_scrollbar"><strong>卸载 </strong><span class="hljs-keyword"><strong>python3</strong>
rpm -<span class="hljs-keyword">qa|<span class="hljs-keyword">grep <span class="hljs-keyword">python3|xargs rpm -ev --allmatches --nodeps 卸载pyhton3
whereis <span class="hljs-keyword">python3 |xargs rm -frv 删除所有残余文件
成功卸载!
whereis <span class="hljs-keyword">python 查看现有安装的<span class="hljs-keyword">python
</span></span></span></span></span></span></span></pre>
<p> -------------------</p>
<pre class="hljs vim mCustomScrollbar _mCS_11 mCS-autoHide mCS_no_scrollbar">The system python on <strong>CentOS 7</strong> must be the <strong>2.7</strong> version that we ship. Must. <br>You cannot replace the system python with a different one. <br>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. <br>No-one yet ships 3.8 as it's too new. There are python 3.6 packages in the <strong>CentOS 7.7</strong> base and updates repos. <br>Use those. <br>They are supported and are the same versions that are in <strong>CentOS 8</strong> so you know things written on one should work on the other.<br><br> -------------------</pre>
<p><span class="bjh-p">Centos <strong>7.8</strong></span></p>
<p><span class="bjh-p"><strong>Python 3</strong> is now available. Installing the python3 package gives you the Python 3.6 interpreter。Python 3 可用,安装python3将会提供Python 3.6解释器。</span></p>
<p><span class="bjh-p">---------------------------------</span></p>
<p><strong><span class="bjh-p"><span class="bjh-p">Centos 8</span></span></strong></p>
<pre class="hljs vim mCustomScrollbar _mCS_11 mCS-autoHide mCS_no_scrollbar"><code>Python 3.6</code> 是默认的 Python 环境,有限支持 Python 2.7<br><br><span class="bjh-p">---------------------------------</span><br><br><br><br></pre><br><br>
来源:https://www.cnblogs.com/emanlee/p/13594389.html 友情提示一下哈,卸载系统Python要谨慎!
看到你想在CentOS上卸载Python,个人建议你三思而行哈。CentOS的系统很多关键组件(比如yum)都是依赖系统Python的,如果盲目卸载可能会导致系统崩溃,到时候就麻烦大了。
如果真的需要:
其实真没必要完全卸载系统Python,你可以选择安装多个Python版本来共存嘛。
更安全的做法:
[*]CentOS 7:直接安装Python3.6就好啦,命令是 yum install python3,这样系统和Python3可以共存
[*]CentOS 8:系统本身就已经内置Python 3.6了,直接用就行
[*]想要更新版本:可以用pyenv或者conda来管理多版本,完全没必要动系统Python
血的教训:之前有人手贱把系统Python卸了,结果yum都用不了了,只能重装系统,得不偿失啊!
如果你是想用新版本Python,完全可以走上面说的共存方案,既安全又方便,何必非要赶尽杀绝呢?你说是不是这个理?
有啥其他问题欢迎继续讨论哈,大家一起进步!https://ym.gs/static/image/smiley/default/shy.gif
页:
[1]