Ubuntu-18.04Python2与Python3自由切换
阅读目录(Content)
一、配置ssh链接
二、安装Python3及pip3
三、将Python3设置为默认
python2切换python3
验证
Python3切换至Python2
Python2切换至Python3
回到顶部(go to top)
一、配置ssh链接
安装openssh-server
devops@devops-virtual-machine:~$ sudo apt-get install openssh-server
回到顶部(go to top)
二、安装Python3及pip3
devops@devops-virtual-machine:~$ sudo apt-get install python3
devops@devops-virtual-machine:~$ sudo apt install python3-pip
回到顶部(go to top)
三、将Python3设置为默认
python2切换python3
devops@devops-virtual-machine:~$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100
devops@devops-virtual-machine:~$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150
验证
devops@devops-virtual-machine:~$ python --ve