We talk about the different Python verions & defaults & how to control them with pyenv
To get the required OS dependencies (adapted from here - https://github.com/pyenv/pyenv/wiki#suggested-build-environment):
sudo apt update --fix-missing
sudo apt install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev llvm libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
To install, read the following READMEs (make sure to check the proper settings for Ubuntu):