I downloaded python version 3.8 on google colab using:
!apt-get install python3.8
Now I want to change the default python version used in google colab
uses from 3.6
to 3.8
. how to do it??
I have read few ans but there are no updates...
In Colab, we can enforce the Python version by clicking Runtime -> Change Runtime Type and selecting python3 . Note that as of April 2020, Colab uses Python 3.6. 9 which should run everything without any errors.
Because of that, Colab is in the process of deprecating Python 2 runtimes; see https://research.google.com/colaboratory/faq.html#python-2-deprecation for details.
Each runtime gives you a fresh google colab. ! sudo update-alternatives --config python3 #after running, enter the row number of the python version you want. NOTE: As mentioned in the comments, the above commands just add a new python version to your google colab and update the default python.
Colab has default python 3.7 and alternative 3.6 (on 26.07.2021)
# Choose one of the given alternatives:
!sudo update-alternatives --config python3
# This one used to work but now NOT(for me)!
# !sudo update-alternatives --config python
# Check the result
!python3 --version
# Attention: Install pip (... needed!)
!sudo apt install python3-pip
try these commands
!update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1
then
!update-alternatives --list python
this must display your downloaded python version
after that
!sudo update-alternatives --config python
## !Set python3.8 as default.
finally
!sudo update-alternatives --set python /usr/bin/python3.8
then check your default python version on colab
!python3 --version
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With