The following commands will help you to install Python 3.9.1 on a Centos 7 or Ubuntu 18.04 machine.
https://www.python.org/ftp/python/ - We'll select the latest version as of Dec 2020 (3.9.1)
sudo yum install gcc openssl-devel bzip2-devel libffi-devel