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
GitHub 加速计划 / col / COLA
9
5
下载
🥤 COLA: Clean Object-oriented & Layered Architecture
最近提交(Master分支:4 个月前 )
bda50471 - 6 个月前
65e9e39d bump org.apache.maven.plugins:maven-compiler-plugin from 3.11.0 to 3.13.0 (#496) bump org.apache.maven.plugins:maven-surefire-plugin from 3.1.2 to 3.2.5 (#497) bump org.springframework.boot:spring-boot-dependencies from 3.1.0 to 3.3.0.(#498) bump org.apache.maven.plugins:maven-javadoc-plugin from 3.6.0 to 3.7.0 (#499) bump commons-cli:commons-cli from 1.5.0 to 1.8.0 (#500) bump org.jacoco:jacoco-maven-plugin from 0.8.10 to 0.8.12 (#501) bump org.apache.maven.plugins:maven-source-plugin from 3.2.1 to 3.3.1 (#502) bump org.wiremock:wiremock-standalone from 3.0.1 to 3.0.3 (#503) 6 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐