I think the title says it all.
Asked
Active
Viewed 3,378 times
9
-
Related: https://askubuntu.com/questions/487860/shifting-between-alternate-versions-of-python-in-ubuntu – Elder Geek Jan 28 '18 at 15:17
2 Answers
9
Python 3 is available from the repositories and can be installed side by side with Python 2:
sudo apt-get install python3 python
You can use the -V
switch to find out the minor version numbers:
$ python3 -V
Python 3.1.2
$ python -V
python 2.6.6

Stefano Palazzo
- 86,783

Mike Axiak
- 470
0
comment: please note that python 2 and 3 will use different output channels for their prints whilst the returned code will be zero in case of success.
command=python2 --version
rc=0
stderr=Python 2.7.12
.
command=python3 --version
rc=0
stdout=Python 3.5.2

Alexander Stohr
- 132
- 13