I want to change the python version on my Google Colab. Currently, it's running python 3.7:
[In]: ! python --version
[Out]: Python 3.7.13
I want python 3.10, so I followed the instructions in this post:
! sudo apt-get update -y
! sudo apt-get install python3.10
! sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
! sudo update-alternatives --config python3
Here, a list is printed, and I choose python 3.10. Then
! sudo apt install python3-pip
Now, when I query the python version, it shows 3.10:
[In]: ! python --version
[Out]: Python 3.10.6
So far so good! BUT, now there are two problems:
- pip seems to be completely broken; I can't pip install anything, e.g. both
!pip install gym
and!pip3 install gym
give the following error:
AttributeError: module 'collections' has no attribute 'MutableMapping'
- Python version shows 3.10, but seems to be still 3.7, as newer syntax throws syntax error, e.g.:
[In]: (a := 3)
[Out]: SyntaxError: invalid syntax
[In]: a: list[int] = [1]
[Out]: TypeError: 'type' object is not subscriptable