如何安装Python 2.x和Python 3.x的并行安装?

我觉得标题已经说清楚了。

相关链接:https://askubuntu.com/questions/487860/shifting-between-alternate-versions-of-python-in-ubuntu - Elder Geek
2个回答

Python 3可以从软件源中获取,并且可以与Python 2一起安装:

sudo apt-get install python3 python

你可以使用-V开关来查找次要版本号。
$ python3 -V
Python 3.1.2

$ python -V
python 2.6.6

请注意,Python 2和3在打印输出时会使用不同的输出通道,而返回的代码在成功的情况下将为零。
command=python2 --version
rc=0
stderr=Python 2.7.12

.

command=python3 --version
rc=0
stdout=Python 3.5.2