Install Python 3.7 by the PPA Method and set it as default.
sudo apt update && sudo apt upgrade
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt update
sudo apt install python3.7 -y
python3.7 --version
sudo apt install python3.7-dev -y
sudo apt install python3.7-venv -y
sudo apt install python3.7-distutils -y
sudo apt install python3.7-lib2to3 -y
sudo apt install python3.7-gdbm -y
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 10
sudo update-alternatives --set python /usr/bin/python3.7
python --version
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 10
python3 --version
sudo apt install python3-pip -y
Add the following to the profile file
PYTHON=/usr/bin/python3
export PYTHON
Then source the profile, e.g.
source ~/.bashrc