[root@kazihuo~]# yum -y install gcc gcc-c++
[root@kazihuo /soft]# wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz
[root@kazihuo /soft]# tar xvf Python-3.6.5.tgz
[root@kazihuo /soft/Python-3.6.5]# ./configure --prefix=/usr/local/python3.6.5
[root@kazihuo /soft/Python-3.6.5]# make && make install
[root@kazihuo /usr/bin]# rm python
[root@kazihuo /usr/bin]# ln -sv /usr/local/python3.6.5/bin/python3 /usr/bin/python
[root@kazihuo ~]# python -V
Python 3.6.5
注意:
因为yum使用python2,替换为py3后可能无法正常工作;
[root@kazihuo ~]# yum list
File "/usr/bin/yum", line 30
except KeyboardInterrupt, e:
^
SyntaxError: invalid syntax
修改yum配置文件即可解决;
[root@kazihuo ~]# head -1 /usr/bin/yum
#!/usr/bin/python2.7
-------------------------------------------------------------
转载请保留此段声明,且在文章页面明显位置给出原文链接,谢谢!
------------------------------------------------------------------------------
如果觉得这篇文章对你有小小的帮助的话,记得在右下角点个“推荐”哦,博主在此感谢!
------------------------------------------------------------------------------