sudo apt-get update
sudo ntpdate pool.ntp.org
sudo apt-get install ntp
Install from source
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
./configure
make
make install
If you get the following error message zipimport.ZipImportError: can't decompress data; zlib not available
update alternatives
update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.7 0
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1
update-alternatives --config python3
python3 -V
sudo apt-get install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
cd /usr/src
sudo wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
sudo tar xzf Python-3.6.4.tgz
cd Python-3.6.4
sudo ./configure --enable-optimizations
sudo make altinstall
python3.6 -V
sudo update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.6 0
sudo update-alternatives --config python3
Installing from PPA
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt update
sudo apt install python3.6
sudo apt-get install python-virtualenv