Python教程

python

本文主要是介绍python,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

1,本机python2.7升级到3.6

一般老的虚机安装时python默认时2.7版本,需要升级

]# which python
/usr/bin/python

ls -lah /usr/bin/python
lrwxrwxrwx. 1 root root 7 Apr 22 2020 /usr/bin/python -> python2

安装python3.6后:

ls -lah /usr/bin/ |grep python
lrwxrwxrwx. 1 root root 7 Apr 22 2020 python -> python2
lrwxrwxrwx. 1 root root 9 Apr 22 2020 python2 -> python2.7
-rwxr-xr-x. 1 root root 7.1K Oct 31 2018 python2.7
lrwxrwxrwx. 1 root root 9 Feb 10 16:46 python3 -> python3.6
-rwxr-xr-x. 2 root root 12K Nov 17 2020 python3.6
-rwxr-xr-x. 2 root root 12K Nov 17 2020 python3.6m

 

升级为python3.6过程:

 yum install epel-release
yum install python36
cd /usr/bin/
删除老软连接,创建新软连接
rm /usr/bin/python
ln -s /usr/bin/python3.6 /usr/bin/python
python --version
这篇关于python的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!