首页 > 解决方案 > 在与谷歌云连接的谷歌colab中更改python版本

问题描述

我在 google colab 中使用 python 3.7,但由于某种原因,当我与谷歌云中的 linux 服务器连接时,python 变为 2.7。我怎样才能改变它?请注意,python 3.7 已经安装在服务器中。

我尝试了这些东西,但没有帮助。

apt update
sudo apt install python3-pip
alias pip='pip3'

我还检查了这些网站https://cloud.google.com/python/docs/setup#linux_2,如何在 google cloud shell 中安装 Python 3.7 但没有解决我的问题。

通过运行时 编辑-> 更改运行时我只能看到这个,选项是'non'、'gpu'、'tpu'。在此处输入图像描述

标签: pythongoogle-cloud-platform

解决方案


您可以通过运行 python --version 在命令行检查您的 Python 版本。在 Colab 中,我们可以通过单击 Runtime -> Change Runtime Type 并选择 python3 来强制执行 Python 版本。


推荐阅读