Python is an open source programming language that it is ideal for all those who want to start programming, but this is just my opinion. Ubuntu 16.04 and Ubuntu 16.10 we can find two versions of Python; 2.7 and 3.5. At the time of writing this article, the last stable version of Python is 3.6.
In this short tutorial we are going to see two easy ways to install Python 3.6 on Ubuntu 16.10, Ubuntu 17.04.
To start, let's check which version of Python you use in your Ubuntu from the command line by typing:
python --version
Installing Python 3.6 on Ubuntu 16.10, Ubuntu 17.04 from the universal repository
Python 3.6 is included in the university repository for Ubuntu 16.10 and Ubuntu 17.04, so it can be easily installed with the following commands:
sudo apt update
sudo apt install python3.6
Once the installation is finished, we are going to check the version that we have just installed by typing the following in the terminal:
python3.6 -V
The previous command will show us a message like this on the screen:
Python 3.6.0
Download, compile and install Python 3.6 on Ubuntu
Now we are going to see how to install Python from scratch by downloading and complicating the package that we are going to download. First, some build dependencies will have to be installed using the following commands.
sudo apt install build-essential checkinstall
sudo apt install libreadline-gplv2-dev libncursesw5-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
Once the installation is finished, we will download the source code from the official page using wget.
wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tar.xz
Once the download is finished, it is time to extract the contents of the package.
tar xvf Python-3.6.0.tar.xz
Once the extraction is finished, we are going to move to the directory where it was extracted using the cd command. Then we are going to configure the compilation environment and install.
cd Python-3.6.0/
./configure
If you get an error when executing the previous command, you can try the following:
./configure –enable-optimizations
sudo make altinstall
By using the altinstall command we will skip the creation of the symbolic link. This order may take a while, so be patient.
Once this is done, you can use the shell provided by the installation to write your codes by typing the following command in terminal:
python3.6
To exit the shell you just have to type:
quit()
Hope this tutorial helps you install Python on Ubuntu 16.10 and Ubuntu 17.04. Just say that if the shell that provides us with these facilities is a bit "austere", for many it is a bit short and uncomfortable. So you can always use Sublime Text 3 to develop your codes in this language or any other editor. Even with gedit you can write your codes without problems.