how to switch python 2.7 to python 3.7 in ubuntu 19.10

I am using Ubuntu 19.10 and I have python 2.7 installed on it. I want to upgrade to python 3.7 on it. How do I do it? I have downloaded for 3.7 version of Linux and installed it. Does it do the needful or I need to install or upgrade to python 3.7. If I have to do then how should I do it?

editthis was a Ubuntu 19.04 virtual machine which was upgraded to 19.10 not a clean install. The VMware image for 19.04 was downloaded from

 debian@osboxes:~$ python -V Python 2.7.17rc1
3

3 Answers

There is no need to use Anaconda or any other third party packages.

Both Ubuntu 19.04 and Ubuntu 19.10 come with Python 3.7 as default Python version.

You can check this with python3 --version in a terminal.

python will and also should refer to Python 2 - this was decided in order to not brake compatibility. Do not try to change this, or you could break parts of your system.

3

Just install python 3

sudo apt install python3.7

and you can use python 3 with the command: python3

thats it.

To install python3.7:

sudo apt-get install python3.7

To make the 'python' command default to python3.7 instead of python2.7:

alias python='/usr/bin/python3.7'

Hope this helps.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like