Ubuntu-18.04Python2与Python3自由切换 阅读目录(Content) 一、配置ssh链接 二、安装Python3及pip3 三、将Python3设置为默认 python2切换python3 验证 Python3切换至Python2 Python2切换至Python3 回到顶部(go to top) 一、配置ssh链接 安装openssh-server [email protected]-Virtual-machine:~$ sudo apt-get install openssh-server 回到顶部(go to top) 二、安装Python3及pip3 [email protected]-Virtual-machine:~$ sudo apt-get install python3 [email protected]-Virtual-machine:~$ sudo apt install python3-pip 回到顶部(go to top) 三、将Python3设置为默认 python2切换python3 [email protected]-Virtual-machine:~$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100 [email protected]-Virtual-machine:~$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150 验证 [email protected]-Virtual-machine:~$ python --version Python 3.6.5 Python3切换至Python2 [email protected]-Virtual-machine:~$ sudo update-alternatives --config python 有 2 个候选项可用于替换 python (提供 /usr/bin/python)。 选择 路径 优先级 状态 ------------------------------------------------------------ * 0 /usr/bin/python3 150 自动模式 1 /usr/bin/python2 100 手动模式 2 /usr/bin/python3 150 手动模式 要维持当前值[*]请按<回车键>,或者键入选择的编号:1 update-alternatives: 使用 /usr/bin/python2 来在手动模式中提供 /usr/bin/python (python) [email protected]-Virtual-machine:~$ python --version Python 2.7.15rc1 Python2切换至Python3 [email protected]-Virtual-machine:~$ sudo update-alternatives --config python 有 2 个候选项可用于替换 python (提供 /usr/bin/python)。 选择 路径 优先级 状态 ------------------------------------------------------------ 0 /usr/bin/python3 150 自动模式 * 1 /usr/bin/python2 100 手动模式 2 /usr/bin/python3 150 手动模式 要维持当前值[*]请按<回车键>,或者键入选择的编号:0 update-alternatives: 使用 /usr/bin/python3 来在自动模式中提供 /usr/bin/python (python) [email protected]-Virtual-machine:~$ python --version Python 3.6.5
python2与3自由切换
Ubuntu-18.04Python2与Python3自由切换
阅读目录(Content)
一、配置ssh链接
二、安装Python3及pip3
0
0
0
精彩评论