sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.8
Ubuntu 14.04 (Trusty) and 16.04 (Xenial)
$ sudo add-apt-repository -y ppa:jblgf0/python
$ sudo apt-get update
$ sudo apt-get install python3.6
Ubuntu 16.10 and 17.04
$ sudo apt-get update
$ sudo apt-get install python3.6
After installation for Ubuntu 14.04, 16.04, 16.10 and 17.04
To invoke the Python 3.6 interpreter, run python3.6.
sudo apt-get install python3.x
where x = 8 or 9
code ~/.bashrc
alias python=python3
source ~/.bash_aliases