How to change the python version used on google colab

I’m trying to install this repo :

on google colab. This is how I have installed conda and opencv=2.4.13 (it requires python 2.7 to work)

pip install conda

!wget -c
!chmod +x

!bash ./ -b -f -p /usr/local

import sys


!conda install -y -q -c conda-forge opencv=2.4.13

Between the others packages,it requires also pyEDM,so I’m trying to install it. I’m following this guide :

I don’t get any error until this command :

!cd pyEDM; pip install .

that gives to me this error :

Processing /content/pyEDM
ERROR: Package 'pyEDM' requires a different Python: 2.7.15 not in '>=3'

Infact when I ask which versions of python I have,it says :

!python2 --version
Python 2.7.15

!python3 --version
Python 3.6.9


So,I should change the python version installed by conda when I have installed opencv 2.4.13 to a version of 3 or greater,otherwise the package can’t be installed. On my local machine I would do that with this command :

!alias python='/usr/bin/python3.6'

but it does not work on colab. When I give the alias command it doesn’t answer anything and the error is still there.

What can I do ?

Leave a Reply