Source from : https://medium.com/analytics-vidhya/importing-your-own-python-module-or-python-file-into-colab-3e365f0a35ec

Step 1

Primarily, you must Mount your google drive in google colab:
Code to below, your files on your google drive is import files/packages inside a google colab.

# Mount your google drive in google colab
from google.colab import drive
drive.mount('/content/drive')

Step 2

Secondly, insert the directory to your python path using sys:

# Insert the directory
import sys
sys.path.insert(0,’/content/drive/My Drive/ColabNotebooks’)

Step 3

Now, you can be able to import your module or file stuff from that directory.

# Import your module or file
import my_module
 

Importing Your Own Python Module or Python File into Colab的更多相关文章

  1. import 本地Python module或package

    很基础很重要的一课,虽然很简单,但是防止以后忘了,还是记下来 这个笔记里说的都是import本地的,自己创建的,或者复制粘贴的别人的,总之“不是安装到library”的module or packag ...

  2. Nuke Python module的使用

    最近很多脚本工作都需要脱离nuke的gui环境运行,没有了script editor就必须要尝试Nuke Python module功能了.该模式可以执行大部分在GUI环境中的命令,在自动生成或者批量 ...

  3. __import__ 与动态加载 python module

    原文出处: koala bear    Direct use of __import__() is rare, except in cases where you want to import a m ...

  4. the ssl module in Python is not available错误解决

    在使用pip安装pymongo的过程中报错,提示如下: $ pip3 install pymongo pip is configured with locations that require TLS ...

  5. windows下pip安装python module失败

    C:\Python27\pywin32-214>setup.py -q install Building pywin32 2.7.214.0 Traceback (most recent cal ...

  6. Dive into re Module in Python

    Dive into RE in Python Standard re module in python is powerful to handle text manipulation,such as ...

  7. Python module all in one

    Python module all in one Python Modules https://docs.python.org/3/tutorial/modules.html Fibonacc # F ...

  8. install python module

    [install python module] 参考:http://docs.python.org/2.7/install/index.html

  9. Python队列服务 Python RQ Functions from the __main__ module cannot be processed by workers.

    在使用Python队列服务 Python RQ 时候的报错: Functions from the __main__ module cannot be processed by workers. 原因 ...

  10. plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory

    装一台新服务器环境的时候,装uwsgi报错: plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or di ...

随机推荐

  1. 使用windows切换程序窗口时关闭edg浏览器的多个选项卡

    关闭edg浏览器切换程序窗口时展示多个选项卡 一.切换程序窗口的方式 当使用电脑打开了多个程序时,可以通过按住快捷键alt+tab(或者使用笔记本的触控屏,三指左右滑动快捷手势)来切换程序窗口. 二. ...

  2. Unity Profiler真机调试

    1.在BuildSetting面板中勾选DevelopmentBuild 2. .cmd命令: adb forward tcp:34999 localabstract:com.CompanyName. ...

  3. Fiddler 教程【转】

    作者: 小坦克  来源: 博客园  发布时间: 2012-07-07 14:20  阅读: 71973 次  推荐: 45   原文链接   [收藏]  阅读目录 Fiddler的基本介绍 Fiddl ...

  4. go new和make区别

    new用于任何类型,返回的是指针,多用在对象,结构体 make类型只用于slice,map,channel,返回引用,为什么只这三个用make,因为它们都有要初始化的数据,参数golang 内置函数n ...

  5. phpstorm go py 30天无线试用

    1.关闭软件(建议先导出设置配置,操作会重置配置) 2.删除文件(一般AppData会被隐藏,需要通过查看选项里面打开查看隐藏文件,不懂自行百度) 删除目录 C:\Users\用户名\AppData\ ...

  6. awk引用外部变量

    test]# cat tmp.tmp120.4987 12.717858119.801948 13.38588119.424529 14.024871119.337438 15.070484119.2 ...

  7. Rest-Assured发送POST请求:创建Hello-imook

    package heyuan.RestAssuredDemo;import static org.junit.jupiter.api.Assertions.*;import org.junit.jup ...

  8. unity002

    物体轴心点变换 轴向变换 预览 暂停 逐帧播放 坐标 世界坐标 物体坐标 mesh 网格决定形状 渲染

  9. HDLbits——Mt2015 lfsr

    1.描述电路图里面的一个子模块 Assume that you want to implement hierarchical Verilog code for this circuit, using ...

  10. Vue 的生命周期 详细解析(使用场景等)

    Vue生命周期图: 一.生命周期图的解读 new Vue():首先需要创建一个 Vue的实例对象 Init Events & Lifecycle :初始化:生命周期.事件(如:v-once), ...