我应该将我的默认 python 版本更改为最新的 python 版本吗?

Should I change my default python version to the latest python version?

我的系统默认有 Python 2.7.9 :-

amitwebhero@AmitKali:~$ python
Python 2.7.9 (default, Mar  1 2015, 12:57:24) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

而且我已经安装了它的最新版本Python 3.5.

amitwebhero@AmitKali:~$ python3.5
Python 3.5.0+ (default, Oct 11 2015, 09:05:38) 
[GCC 5.2.1 20151003] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

但是每当我想在终端中编译一个 python 程序时,我需要写 python3.5 file_name.py ,所以我想改变我的默认 python 版本。

但是我已经安装了基于 python 2.7.9 的插件和程序,所以我怀疑如果我将 python 3.5 设置为默认值那么它可能会导致所有这些插件出现问题我使用以前版本的 python.

安装

如果可能,请尝试告诉我是否应该更改我的默认设置 python?

首先取决于操作系统。对于 windows - 也许你可以。那里应该没有太多对 Python 的依赖。

但我支持os你运行linux基于os。

例如,对于 centos,您可能会破坏 yum 包管理器 - 据我所知,它仍然依赖于 Python2。 Ubuntu 尽管他们计划从 16.04 开始迁移到 P3,但也有很多依赖于 P2 的包。

为了方便您的工作,您可以添加以下行作为 .py 文件的第一行:

#!/usr/bin/env python3

使你的 .py 文件可执行:chmod a+x 你可以简单地 运行 它没有解释器名称。