This is pretty simple when comes to compiling Python on any *nix OS. There must compilation tools to be first installed before continuing onto compiling a opensource software such as the Python programming language.
on Ubuntu types of Distros:
we must install the following tools on the command prompt.
>>> sudo apt-get install build-essential
on CentOS like OSes:
We can do the following to obtain development tools
>>> sudo yum groupinstall 'Development Tools'
Finally, we can then roll over to python website to download the latest release candidate.
Download either the Gzipped source tarball or XZ compressed source tarball. If you have downloaded the GZ source code package. We can do the following to extract code into a directory and compile like a boss.
>>> tar xzvf Python-3.9.0rc2.tar.gz
>>> cd Python-3.9.0rc2/
Missing _lzma ? No problem we can first install xz and lzma using macports then configure the CFLAGS and LDFLAGS ENV variable to enable lzma header info unto bash.
>>> sudo port install xz lzma
>>> export LDFLAGS="-L/opt/local/lib"
>>> export CFLAGS="-I/opt/local/include"
>>> ./configure --enable-optimizations
>>> make test
>>> make install