centos下python2升级python3思路

1.下载安装python3
2.修改python系统的默认指向,修改软连接。

()修改系统默认的python修改为2..5版本
 
# mv /usr/bin/python /usr/bin/python2.7.5
 
()创建软连接使python指向新版本
 
# ln -s /usr/local/bin/python3. /usr/bin/python
 
()检测是否更新成功
 
[root@localhost ~]# python
Python  ( , ::)
[GCC   (Red Hat -)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

3.yum报错解决

2.vim /usr/bin/yum

   修改python头部python为python2.7.5

#!/usr/bin/python2.7.5
import sys
try:
    import yum
except ImportError:
    print >> sys.stderr, """\
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

这个只是思路概括
在不同的机器上很可能有细微的差别

本文链接:

https://heyzen.club/index.php/Coder/194.html
1 + 2 =
快来做第一个评论的人吧~