Install Python 3.6 on Ubuntu 16.04 Xenial
By default Ubuntu is shipped with Python 3.5.2 or whatever but to use latest version (e.g. 3.6.4 as in example below) you need to install it manually. So we need to download dependencies, source code and the build it by yourself. You may execute commands from your home directory or from any other temporary directory (we need source code only once)
$ sudo apt install build-essential zlib1g-dev libreadline-dev libssl-dev openssl
And that’s it!
Now verify your installation with
$ pip3 --version
If you want to type python3 in terminal and open a latest installation you may need to symlink your executable with the alias like this
which python3 # output path 1 which python3.6 # output path 2 # e.g. sudo ln -sf /usr/local/bin/python3.6 /usr/local/bin/python3 sudo ln -sf [output path 2] [output path 1]