


Building Python 3.7 from source on Ubuntu and Debian Linux
https://solarianprogrammer.com/2017/06/30/building-python-ubuntu-wsl-debian/
    
    sudo apt update
    sudo apt upgrade    

    sudo apt install libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev
    sudo apt install libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev libffi-dev uuid-dev

If you want to be able to develop GUI applications
    sudo apt install tk-dev

Next, we are going to get the latest stable version of Python, 
build it and install it in /opt. 
We want to keep this completely isolated from the system Python.

Using 3.7.4 as an example...
    wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tar.xz
    tar xf Python-3.7.4.tar.xz
    cd Python-3.7.4
    ./configure --enable-optimizations --prefix=/opt/python-3.7.4

    make -j 8
    sudo make install

Temporarily, add Python to your PATH. 
Please note, that this will temporary shadow, until you close the Terminal or until you log out, 
the default system python3.

    export PATH=/opt/python-3.7.4/bin:$PATH

After the above, you can invoke the new Python interpreter with:
    python3

to go back to the default system Python version, 
close and reopen your Terminal or log out and log in to your system.
