阅读目录(Content)
- 一、配置ssh链接
- 二、安装Python3及pip3
- 三、将Python3设置为默认
- python2切换python3
- Python3切换至Python2
- Python2切换至Python3
回到顶部(go to top)
一、配置ssh链接
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 --version
Python 3.6.5
Python3切换至Python2
devops@devops-virtual-machine:~$ sudo update-alternatives --config python
有 2 个候选项可用于替换 python (提供 /usr/bin/python)。
devops@devops-virtual-machine:~$ sudo update-alternatives --config python
有 2 个候选项可用于替换 python (提供 /usr/bin/python)。