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


Answers:


8

可以从存储库中获取Python 3,并且可以将其与Python 2并排安装:

sudo apt-get install python3 python

您可以使用该-V开关找出次要版本号:

$ python3 -V
Python 3.1.2

$ python -V
python 2.6.6

0

注释:请注意,python 2和python 3将使用不同的输出通道进行打印,而成功返回的代码将为零。

command=python2 --version
rc=0
stderr=Python 2.7.12

command=python3 --version
rc=0
stdout=Python 3.5.2
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.