Python normally comes in two version python-2 and python-3. If you are just a beginners ,like many , you might wonder too what is the difference but I would just recommend to get going with python version 3. With time you can explore the difference.

installing python on ubuntu machine

Check if python is installed:

Most of the system mainly linux based system comes with python pre-installed. In such case, we don’t need to install it again. To check if your system already have the python installed or not. Just type python in the terminal. If you see some message with python version then you already have the python installed in your system. Nowadays, the pre-installed version of python is python-3. If you want to install the python-2 follow the steps bellow.

Installing python-2 in ubuntu:

Installing python-2 is very easy in ubuntu machine. Simply type the following command in terminal. To open the terminal type ctrl+alt+t or open it manually.

sudo apt-get update && apt-get install python

Installing python-3 in ubuntu:

To install python-3 in ubuntu machine follow the steps bellow.

sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6

Opening desired python version if both python2 and python3 is installed.

Yes, we can have both version of python installed. In such scenario if we type python, the python version2 interpreter will start. for starting python version3 type python3.

Similarly, if we use python or python3 command to execute the script in respective python.