This is on Ubuntu 14.04, but should work in any Linux/OSX system:-
mkdir -p $HOME/python/3.6
wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
tar xzf Python-3.6.0.tgz
cd Python-3.6.0/
./configure --prefix=$HOME/python/3.6
make
make test
make install
Now our python should be ready in $HOME/python/3.6, let's try to run it:-
$HOME/python/3.6/bin/python
Python 3.6.0 (default, Mar 4 2017, 08:09:48)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/home/kamal/python/3.6/lib/python36.zip', '/home/kamal/python/3.6/lib/python3.6', '/home/kamal/python/3.6/lib/python3.6/lib-dynload', '/home/kamal/.local/lib/python3.6/site-packages', '/home/kamal/python/3.6/lib/python3.6/site-packages']