[root@junper ~]# dnf install python2 python3 -y
[root@junper ~]# python2 -V
Python 2.7.15
[root@junper ~]# python3 -V
Python 3.6.8
[root@junper ~]# python -V
-bash: /usr/bin/python: No such file or directory
[root@junper ~]#

Python 3 默认

[root@junper ~]# alternatives --set python /usr/bin/python3
[root@junper ~]# python -V
Python 3.6.8

Python 2 默认

[root@junper ~]# alternatives --set python /usr/bin/python2
[root@junper ~]# python -V
Python 2.7.15

另外一种方案

update-alternatives --install /usr/bin/python python /usr/bin/python2 100

update-alternatives --install /usr/bin/python python /usr/bin/python3 150

京东云 CentOS 设置Python 默认版本_bash

 

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6
标签: centospython