Steps to be followed
- When the terminal opens, run the command to add PPA
sudo add-apt-repository ppa:deadsnakes/ppa
- Refresh the package cache via the command below,
sudo apt update
- Then finally install Python 3.11 via the command
sudo apt install python3.11
4. To verify, use the below screenshot command
To set 3.11 as the default
5. First, run the command to create symbolic links for the system default python
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 110
6. Then, add the new Python version via the command
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 100
7. Then, choose the python as python3 via run the below command
sudo update-alternatives --config python3
Select your require version of python as you decided to make as default