how to use python 3.6 in google Colab


I want to work with python 3.6 due to some file compatibility issue, can anyone help me out, where I can use python 3.6 in google Colab, apart from that I want to use tensorflow 2.0 and opencv, which I have already install in Colab am only stuck with python 3.6. any help would be appreciated


You can use the command below and then select the alternative version to change the python version.

!sudo update-alternatives --config python3


There are 2 choices for the alternative python3 (providing /usr/bin/python3).

  Selection    Path                Priority   Status
* 0            /usr/bin/python3.7   2         auto mode
  1            /usr/bin/python3.6   1         manual mode
  2            /usr/bin/python3.7   2         manual mode

Press <enter> to keep the current choice[*], or type selection number: 1
update-alternatives: using /usr/bin/python3.6 to provide /usr/bin/python3 (python3) in manual mode 

To check the python version use the following code.

python --version # 3.6.9

Answered By – Tfer3

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published