Python is an interpreted, high-level, general-purpose programming language. To start working with Python, you will need to install the Python interpreter which can be obtained from the Python Software Foundation website at https://www.python.org.
Installing Python on Linux
There is a very good chance your Linux distribution has Python installed already, but it probably won’t be the latest version, and it may be Python 2 instead of Python 3.
To find out what version(s) you have, open a terminal window and try the following commands:
$ python --version $ python2 --version $ python3 --version
If the version shown is 2.x.x or a another Python 3 version that is not the latest (3.7.4 as of this writing), then you will want to install the latest version. The installation might differ depending on the Linux distribution you are using.
If you are running Ubuntu 17.10 or Ubuntu 18.04 (and above), it already comes with Python 3.6 by default. You should be able to invoke it with the command python3.
Ubuntu 16.10 and 17.04 do not come with Python 3.6 by default, but it is in the Universe repository. You should be able to install it with the following commands:
$ sudo apt-get update $ sudo apt-get install python3.6
If you are using Ubuntu 14.04 or 16.04, its repository does not contain Python 3.6, but you can get it from a PPA, using the command bellow:
$ sudo add-apt-repository ppa:deadsnakes/ppa $ sudo apt-get update $ sudo apt-get install python3.6
Red Hat Enterprise and CentOS
With Red Hat Enterprise and CentOS distributions, you can install with yum package manager.
$ sudo yum update $ sudo yum install yum-utils $ sudo yum install https://centos7.iuscommunity.org/ius-release.rpm $ sudo yum install python36u $ sudo yum install python36u-pip
$ sudo dnf install python36
$ packman -S python
I hope you now you have the latest Python version installed! You are now ready to begin interacting with it!