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. 【记录】Linux Mint Cinnamon Desktop Enviroment使用记录

    之前使用的系统是Kali Linux,并不是看上了一堆工具,工具的话上虚拟机不好吗,会折腾的docker更好阿,主要是 1. 用习惯了gnome的桌面环境 2. 开箱即用 很多配置他都已经做好了 我都 ...

  2. python36

    无限循环 如果条件判断语句永远为 true,循环将会无限的执行下去,如下实例: 实例 #!/usr/bin/python # -*- coding: UTF-8 -*- var = 1 while v ...

  3. CRC校验模板

    #ifndef CRC_H #define CRC_H #include "main.h" #ifdef CRC_C #endif typedef struct { uchar R ...

  4. vue pdf下载(非预览)

    只需改掉 选择器名称 和 图片存放的URL 即可使用 downloadimg(){ let _this=this let url = 'https://PDF或者图片路径/Merged.pdf' le ...

  5. 使用Kali破解无线密码

    1.查看网卡信息,是否有wlanX网卡ifconfig 2.启动网卡监听模式 airmon-ng start wlan0 检查下是否处于监听模型:ifconfig查看一下,如果网卡名加上了mon后则成 ...

  6. 设置eclipse默认编码为UTF-8 Set default encoding to utf-8 in eclipse

    设置eclipse默认编码为UTF-8 Set default encoding to utf-8 in eclipse 1,windows->Perferences->General-& ...

  7. mysql主从备份双机热备实现方法

    1.环境准备 主服务器(master):192.168.1.1 从服务器(slave):192.168.1.2 要求主从服务器mysql版本相同且大于3.23 2.主服务器 2.1创建同步用户 cre ...

  8. Finance_CAPM&APT

    ACCA CAPM: https://www.bilibili.com/video/BV1KE411j7Ri?from=search&seid=14840285521502157259 投资学 ...

  9. 学习lua-03,集合排序,集合插入元素

    array = {"Google", "Runoob"} table.insert(array,1,"hello world!") for ...

  10. holiday04

    第四天 查看文件内容 命令 英文 作用 cat 文件名 concatenate 查看.创建.合并.追加文件等功能 more 文件名 more 分屏显示文件内容 grep 搜索文本 文件名 grep 搜 ...