使用 Ubuntu 16.04
试图将 python 3.6 设置为python3
命令的默认值。我找到了似乎是答案,并没有仔细阅读就快速复制粘贴了以下几行:
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1
update-alternatives: using /usr/bin/python3.6 to provide /usr/bin/python (python) in auto mode
$ sudo update-alternatives --set python /usr/bin/python3.6
Run Code Online (Sandbox Code Playgroud)
这是结果:
$ python3
Python 3.5.2 (default, Nov 12 2018, 13:43:14)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
$ python
Python 3.6.8 (default, Dec 24 2018, 19:24:27)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.python …
Run Code Online (Sandbox Code Playgroud)