Install Python 3.8 on Ubuntu
1. Add the PPA
Open terminal and run command:
Type user password (no asterisk feedback) when it prompts and hit Enter to
continue.
sudo add-apt-repository ppa:deadsnakes/ppa
2. Install Python 3.8
Refresh system package cache:
sudo apt update
Install Python 3.8:
sudo apt install python3.8
3. Once successfully installed, check your system Python versions
Run command:
python3 --version
4. (Optional) To use Python 3.8 as the default python3
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6
1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2
For Ubuntu 16.04 replace python3.6 with python3.8. And you can then switch
between the two Python3 versions via command:
sudo update-alternatives --config python3
Type number 2 when the "Press [enter] to keep the current choice[*], or
type selection number:" appear.
NOTE: You can create a symlink to use default python via command:
sudo ln -s -f $(which python3) $(which python)
Check python version with command:
python --version
5. Uninstall Python 3.8
To uninstall the Python 3.8 packages, run command:
sudo apt remove --autoremove python3.8 python3.8-minimal
To remove the Deadsnakes PPA, launch Software & Updates and go to Other
Software tab, then remove the repository line and close the window.