If i type "python3.7 --version" into terminal: result is: Python 3.7.3 If i type "/usr/bin/python3 -V" into terminal: result is: Python 3.6.7 Since this entry i installed pip and then ran "python --version" as advised by https://packaging.python.org/tutorials/installing-packages/#ensure-you-can-run-python-from-the-command-line result now is Python 2.7.15rc1 I am trying to learn Python from scratch. I am using Visual Studio Code and i have run into a problem. When i run terminal in Visual Studio Code; which version of Python will it be using?

  • What Ubuntus version? – Jim Apr 14 at 5:10

Ubuntu 18.04 uses 3.6.7 by default, so this is the expected result from running python3—because /usr/bin/python3 linked to python 3.6.7.

You can link it to your desired python version, but this is not preferable way because it might break things and create incompatibility. Instead, you can create alias to make python command behaves as your desire python version.

emmet@ansmachine:~$ alias python=/usr/bin/python3.7
emmet@ansmachine:~$ python --version
Python 3.7.1

The "which" command can be useful for things like this, it will tell you the pathname of the file that will be executed by a given command.

For example:

which python

tells you which file will be executed by the "python" command, and

which python3

tells you which file will be executed by the python3 command. Since you appear to have a separate python3.7 command you can check that also using

which python3.7

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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