如何在google colaboratory中导入python文件? [英] How to import python files in google colaboratory?
本文介绍了如何在google colaboratory中导入python文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在Google Colab上运行我的程序;我的代码使用单独编写的.py文件.
I am trying to run my program on Google Colab; where my code make use of .py files written seprately.
在正常系统中,所有文件都位于一个文件夹中,并且可以使用import xyz
正常工作,但是当我尝试在Google驱动器中使用同一文件夹时,会导致导入错误.
In normal system I have all files inside one folder and it works using import xyz
, but when I tried using same folder in Google drive it gives import error.
推荐答案
现在在googlecolab(11月18日)中,您可以轻松上传python文件
Now in googlecolab(Nov 18) you can upload your python files easily
- 导航到文件(在左侧面板中显示选项卡)
- 点击上传"上传您的python文件夹或.py文件
- 使用googlecolab图书访问文件.
请在下面查看我的屏幕截图!
Please check my screenshot below!
这篇关于如何在google colaboratory中导入python文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文