From here, we can pretty much follow the exact same procedure.
On a terminal just do the following steps:
Install dependencies:
sudo apt install build-essential checkinstall libreadline-gplv2-dev \
libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev \
libbz2-dev openssl
Download and untar the desired version:
mkdir -p $HOME/opt
cd $HOME/opt
curl -O https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
tar -xzf Python-3.6.4.tgz
Install python3.6 while keeping python3.5 as the default python3 version on ubuntu 16.04.
cd Python-3.6.4/
./configure --enable-shared --enable-optimizations --prefix=/usr/local LDFLAGS="-Wl,--rpath=/usr/local/lib"
sudo make altinstall
Check it was installed properly:
>> python3.6 -V
Python 3.6.4
Enjoy!