POST
Install python3.6 on ubuntu16.04
Today I spent some time installing the python3.6 on my ubuntu16.04. Here is a short note for the process, which might be useful for anyone who wants to do the same thing.
The first thing before you start to install the python3.6 is that you need to know which version of python is on your system. On ubuntu16.04 you can use the below command to check your python version.
For example, before the installation, I have python2.7 and python3.5 on my ubuntu system. They are actually default installed by ubuntu16.04 build.
then input python --version
to check which version python is your default python application.
If you want to switch to another python version, input the below command
Here I switched my default python version to python3.5.
But python3.5 is still not the right one, what I need is python3.6. To install python3.6, there are usually two methods. one is using apt-get install
. The command is as below.
Unfortunately, it doesn’t work on my installation for the PPA has been removed. Therefore I turned to the second way to download the source code and compile, install it. The command as below.
Waiting for the installation to complete. Then check the python version, if you see the “Python 3.6.x”, python3.6 has been installed successfully on your ubuntu16.04.
If you don’t see the Python3.6.x, instead, you see Python3.5.x or else, which means your system’s default python version isn’t python3.6. You need to use update-alternatives --config python
command to switch it to python3.6.
Like this.
If you find below message, represents the alternatives failed to recognize python and you must install python into your alternatives list firstly.
install your python by below command.
The last character of above each command sets the priority of your pythons on the system. The bigger the higher priority. After installment, check again. you will see all your pythons are in the alternatives.
Then switch to root user and execute the last command to choose which python you are going to set as default.
If you see the below menu, congratulations, just select the one you want.
We have done all the job for now. Hope this short article can give you help if you have the same requirement as me.
If you have any questions, please ask in below comment box.