Create a virtual environment with the new version:
Replace python3.x with the desired version (e.g., python3.10 ).
To update Python on Ubuntu-based systems (e.g., Ubuntu, Linux Mint):
# Install pyenv curl https://pyenv.run | bash
apt list -a python3
Most Linux distributions come with package managers that allow you to easily install and update software packages, including Python.
python --version