Python Install Version:
1. Update APT and install dependencies
sudo apt update
sudo apt install software-properties-common -y
2. Add the deadsnakes
PPA
The deadsnakes
repository contains newer Python versions:
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
3. Install Python 3.11
sudo apt install python3.11
You can also install Python 3.10 similarly:
sudo apt install python3.10
For Virtual env:
sudo apt install python3.10-venv
Then python3.10 -m venv venv