如何将python版本从Google Colab的默认3.5更改为3.8 [英] how to change the python version from default 3.5 to 3.8 of google colab

查看:362
本文介绍了如何将python版本从Google Colab的默认3.5更改为3.8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下方法在google colab上下载了python版本3.8:

I downloaded python version 3.8 on google colab using:

!apt-get install python3.8

现在,我想将 google colab 中使用的默认 python版本从 3.6 更改为 3.8 .怎么做??

我读了几个ANS,但没有更新...

Now I want to change the default python version used in google colab uses from 3.6 to 3.8. how to do it??

I have read few ans but there are no updates...

推荐答案

在我看来,没有好"的东西.做到这一点的方法.您可以做的是使用shebang行开始脚本.shebang行将为以下代码设置python版本.在此处找到一些相关的答案和信息.如何告诉Python脚本使用特定版本

In my opinion there is no "good" way to do this. What you can do is start your script with a shebang line. A shebang line will set the python version for the following code. Find some related answers and informations here. How do I tell a Python script to use a particular version

在此处找到有关如何在colab中使用shebang的一些信息.https://colab.research.google.com/github/jhermann/blog/blob/master/_notebooks/2020-02-28-env_with_arguments.ipynb#scrollTo=SYv4FagrzLVu

Find here some informations on how to use shebang in colab. https://colab.research.google.com/github/jhermann/blog/blob/master/_notebooks/2020-02-28-env_with_arguments.ipynb#scrollTo=SYv4FagrzLVu

当您具有适用于更多版本python的脚本时,可能会遇到此问题.使用多个python进行交易python文件必须使用#!/bin/env python

When you have script for more versions of python you might come across this issue. Dealing with multiple python versions when python files have to use #!/bin/env python

这篇关于如何将python版本从Google Colab的默认3.5更改为3.8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆