Usually build python from scratch.
This will install the required libraries:
sudo apt install libssl-dev zlib1g-dev libbz2-dev ncurses-dev uuid-dev
sudo apt install build-essential libncurses5-dev libgdbm-dev libnss3-dev libreadline-dev libffi-dev tk-dev
sudo apt install libsqlite3-dev liblzma-dev lzma-dev libgdbm-compat-dev lzma
Current release found at https://python.org
wget https://www.python.org/ftp/python/3.8.3/Python-3.8.3.tar.xz
Build python and install it into a user directory:
./configure --prefix=$HOME/sw --enable-shared --enable-optimizations --with-ensurepip=upgrade
make -j12
make install
It was end of life on 1 Jan 2020, but it’s still a zombie.
https://www.python.org/downloads/release/python-2718/
#end_src
I always had problems building python 2.x with more than one thread.
./configure --prefix=$HOME/sw --enable-optimizations --with-ensurepip=yes --enable-shared LDFLAGS=-Wl,-rpath=/home/apn/sw/lib
make