Update Google Colab Python version

Check current python version

!python --version

Check available versions installed on your colab

!sudo update-alternatives --config python3

If the version you are looking for is not listed, update the repositories

!apt update

Get list of available versions

!apt search package-name

Update to the desired version

!apt install python3.11

Update the available list

!sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1

Then select the desired one

!sudo update-alternatives --config python3

Check

!python --version

Voila !