Currently Google Colab runs on python 3.7 version. But for my project I need to change it to at least 3.8 version. So I've tried with multiple solutions but none of them are actually updating the version.. Yes when I use !python --version
I get new version, but in sys.path
and sys.version
are showing me older path as well as older python version..
!sudo apt-get update -y
!sudo apt-get install python3.9
!sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
!sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 2
!sudo update-alternatives --config python3 # 0 for latest version 3.9
!sudo apt-get install python3-pip
!sudo apt install python3.9-distutils
!python -m pip install --upgrade pip
!python3 -m pip --version
After all of these commands I get pip 22.3.1 from /usr/local/lib/python3.9/dist-packages/pip (python 3.9)
and Python 3.9.15
from running these 2 commands !pip --version
and !python --version
But when I try to print sys.path and sys.version it's the same.. Also I've tried to append path to sys.path (removing all other paths for 3.7 and adding for 3.9) but still version is older one..