This guide provides a step-by-step process to install different versions of Python and manage them using virtual environments.
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.9
sudo apt install python3.9-venv
5. Make a (hidden) Folder for Virtual Environments
mkdir ~/.venvs
python3.9 -m venv ~/.venvs/my-venv-name
source ~/.venvs/my-venv-name/bin/activate
python -V
pip3 --version
deactivate