I want to upgrade python version

Type to terminal below code blocks.
  1. 1.
    Update apt
sudo apt update
  1. 2.
    Download python version which you want
sudo apt install python3.8
  1. 3.
    Change python
which python3 # use result1
which python3.8 # check python version and use result2
sudo update-alternatives --install /usr/local/bin/python3 python /usr/bin/python3.8 1
# Change /usr/local/bin/python3 to result1
# Change /usr/bin/python3.8 to result2