linux 中切换默认python版本

为了不影响原来的python3.5又想手贱升级python3.6才有了这一说      = =

(python3.6安装)

$ sudo add-apt-repository ppa:jonathonf/python-3.6
$ sudo apt update
$ sudo apt install python3.6
选择版本时要小心,不要去动 python(python2),只使用我说的 python3,Python 2.7 编写了各种系统工具,如果你尝试用错误的解释器版本运行它们,可能就不会工作。

设置python 默认设置

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2

查看设置

update-alternatives --list python3

然后设置默认选项,选择对应版本就好啦

update-alternatives --config python3
linux 中切换默认python版本_第1张图片
image.png

你可能感兴趣的:(linux 中切换默认python版本)