Python is an open source, portable, free, customization, effective and modern programming language that offers a wide range of attractive functionality and allows application developers to create software projects that are fully compatible with all mainstream operating systems. This article helps you to install Python 3.5.6 on Ubuntu.
Step #1 Install Required Packages
Use the following command to install required packages.
$ sudo apt-get install build-essential checkinstall
$ sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
Step #2 Download Python 3.5.6
You can download the python from official site. You can also download latest version using the below command.
$ cd /opt
$ wget https://www.python.org/ftp/python/3.5.6/Python-3.5.6.tgz
Now extract the downloaded package.
$ sudo tar xzf Python-3.5.6.tgz
Step #3 Install Python using Source Code
Now use below commands to compile python source code on your system.
$ cd Python-3.5.6
$ sudo ./configure $ sudo make $ sudo make install
Note: If you want to used to prevent replacing the default python binary file /usr/bin/python. $ cd Python-3.5.6
$ sudo ./configure $ sudo make altinstall
Step #4 Check the Python Version
Finally, you have successfully installed Python 3.6 on your system. Now you can check the version using below command.
$ sudo python3.5 -V
Reference : Python Official Website