Open the terminal using Ctrl + Alt + T .
Step 1:- First update the repositories by using the command.
$ sudo apt-get update
Step 2:- Add Deadsnakes Repositories.
$ sudo apt-get install software-proprerties-common
$ sudo add-apt-repository ppa:deadsnakes/ppa
Step 3:- Perform Step 1
Step 4:- Install Python
$ sudo apt-get install python3.8
Step 5:- Now, run the below command
$ python --version
Change default python version
- The above command may show you python 2.x version as it is default python version. To change it ,follow the commands.
$ sudo nano ~/.bashrc
- At the end of the file, append the following line.
alias python=python3.8
- Save the file and run the below command in terminal.
$ sudo source ~/.bashrc
$ python --version
It will show you the current version as of now python 3.8.3