赞
踩
1、切换python
!sudo update-alternatives --config python3
输出如下,键入1则切换为3.6
There are 2 choices for the alternative python3 (providing /usr/bin/python3).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/python3.8 2 auto mode
1 /usr/bin/python3.6 1 manual mode
2 /usr/bin/python3.8 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
如果没有就强行安装,把3.8换成3.6即可,然后再去切换
!sudo apt-get update -y
!sudo apt-get install python3.8
!sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
!sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 2
!sudo apt-get install python3.8-distutils
此时用如下命令则能看到版本已经切换
!python -V
2、安装pip
colab上的python3.6没有自带pip,用如下进行安装
!sudo apt-get install python3-pip
!python -m pip install --upgrade pip
此时便能成功安装tensorflow==1.15
不过运行程序时大概率你会发现你还需要安装如下
!pip install ipykernel
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。