Install Python on Ubuntu Server

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

  1. Make sure you have the right tools before start:
    sudo apt -y install make gcc zlib1g-dev libffi-dev
  2. Go here and select Latest Python 3 Release. Then copy the url of the version Gzipped source tarball located at the bottom.
  3. 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
  4. Extract: tar -xvf Python-3.8.2.tgz
  5. Next you need to run the c program “configure” to check the built.
    cd Python-3.8.2/
    ./configure
  6. Now is the time to install Python:
    make and when it finish sudo make install

You can check your new version with: python3 --version