From here, we can pretty much follow the exact same procedure.
On a terminal just do the following steps:
Install dependencies:
sudo apt install build-essential checkinstall libreadline-gplv2-dev \
libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev \
libbz2-dev openssl libffi-dev liblzma-dev
sudo ldconfig
Download and untar the desired version:
mkdir -p $HOME/opt
cd $HOME/opt
curl -O https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tar.xz
tar -xf Python-3.8.5.tar.xz
Install python3.8 while keeping python3.6 as the default python3 version on ubuntu 18.04.
cd Python-3.8.5/
./configure --enable-shared --prefix=/usr/local LDFLAGS="-Wl,--rpath=/usr/local/lib" --enable-optimizations
sudo make altinstall
Check it was installed properly:
>> python3.8 -V
Python 3.8.5
Enjoy!
Even after running all the commands I'm not getting the desired version as 3.8.5
Earlier I had version 3.8.10 but i want to use 3.8.5