我想使用python 3.6由于一些文件兼容性问题,谁能帮助我,在那里我可以使用python 3.6在谷歌Colab,除了我想使用tensorflow 2.0和opencv 4.0.0.21,我已经安装在Colab我只坚持python 3.6。如有任何帮助,不胜感激
# first install python 3.6
!sudo apt-get update -y
!sudo apt-get install python3.6
# change alternatives
!sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
# select python version
!sudo update-alternatives --config python3
# check python version
!python --version
# install pip for new python
!sudo apt-get install python3.6-distutils
!wget https://bootstrap.pypa.io/get-pip.py
!python get-pip.py
# upgrade pip
!sudo apt install python3-pip
!python -m pip install --upgrade pip
您可以使用下面的命令,然后选择备选版本来更改python版本。
!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
使用以下代码检查python版本。
python --version # 3.6.9