I have python 2.7 and 3.4 versions installed.
But when I say say "python -V", it shows version as 2.7 not 3.4
How to tell ubuntu to use newest python? where is this setting configured ?
12.04playonlinuxpython
I have python 2.7 and 3.4 versions installed.
But when I say say "python -V", it shows version as 2.7 not 3.4
How to tell ubuntu to use newest python? where is this setting configured ?
Best Answer
if you run
python -V
, you get:Python 2.7.6
, However, if you runpython3 -V
, you get3.4.0
.Running a script, you can specify the python version to use by using either:
or:
If the script or application is executable, and you run it without the
python
(either 2 or 3) command, you need to have the shebang in your script, in which you define the python version to use; either:or:
You cannot run code, written for python2 with python3 and vice versa, so you should not (try to) "tell" Ubuntu to use either version 2 or 3 in another way then above, according to the version of python, used in your code.