Automatic Install
Let's first check the version with: python3 --version
To check all python versions you have: apt list --installed | grep python
Install Python through apt: sudo apt install python3
If you want to upgrade it: sudo apt upgrade python3
Manual Installing the latest version
- Make sure you have the right tools before start:
sudo apt -y install make gcc zlib1g-dev libffi-dev
- Go here and select Latest Python 3 Release. Then copy the url of the version Gzipped source tarball located at the bottom.
- Get the file using the url you copied with the latest version:
wget https://www.python.org/ftp/python/3.8.2/Python-3.8.2.tgz
- Extract:
tar -xvf Python-3.8.2.tgz
- Next you need to run the c program “configure” to check the built.
cd Python-3.8.2/
./configure
- Now is the time to install Python:
make
and when it finishsudo make install
You can check your new version with: python3 --version