3

This question already has an answer here:

I've just now installed Python 3.7 and I'd like to understand why I get the following output from bash:

g-luca@hp-notebook:~$ python3.7 -V
Python 3.7.0
g-luca@hp-notebook:~$ python3 -V
Python 3.5.2
g-luca@hp-notebook:~$ python -V
Python 2.7.12

marked as duplicate by mikewhatever, Community Sep 29 '18 at 13:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

You need to check which symlinks are in place. The Python binaries are located in the directory /usr/bin (check with which pythonX.Y). The python3 symlink points to the python3.5 binary.

As mentioned in the comments: if you don't want to type python3.7 every time you shouldn't change the symlink. Changing the Python version might brake system stuff in unexpected ways. You should rather create an alias in your shell. In Bash you would add something like alias python=python3.7 into ~/.bashrc.

  • 2
    You should mention that, changing that python3 symlink is generally a bad idea. because it can break the whole system if you do. same with the python symlink. – Videonauth Sep 28 '18 at 8:27
  • I've Python2, 2.7, 3 and 3.5 at /usr/bin and Python3.7 at /usr/local/bin. which python says /usr/bin that is why Python3.7 is not the default one. The reason why starts Python2.7 instead of Pyhton3.5 installed in same folder, should reside in the symlinks, am I right? – glc78 Sep 29 '18 at 14:14
  • @glc78 Yes, /usr/bin/python is a symlink to /usr/bin/python2.7, therefore this is the default. – Sethos II Sep 30 '18 at 9:34
  • @SethosII And I leave it as it is, just made an alias for python3.7 command. A question: are the old versions of Python required for backward compatibility? – glc78 Sep 30 '18 at 13:32
  • 1
    @glc78 The versions from the ubuntu repository are the ones used for testing the python software in the repositories. So it isn't about backward compatibility but stability. – Sethos II Oct 1 '18 at 5:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.