美文网首页大数据 爬虫Python AI Sql
linux 中切换默认python版本

linux 中切换默认python版本

作者: 东京的雨不会淋湿首尔 | 来源:发表于2017-09-22 00:17 被阅读238次
为了不影响原来的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
image.png

相关文章

网友评论

    本文标题:linux 中切换默认python版本

    本文链接:https://www.haomeiwen.com/subject/bplxextx.html