1. Install aptitude
sudo apt-get install aptitude
2. Installation dependencies
sudo aptitude -y install gcc make zlib1g-dev libffi-dev libssl-dev
3. Download Python 3.6.9
wget https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz
4. extracting archive
takes -xzvf Python 3.6.9.tgz
5 into the folder, and the installation configuration
cd Python-3.6.9 /
./configure --prefix=/usr/local/python36 --enable-shared CFLAGS=-fPIC --enable-optimizations
make && make install