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. centos 等保漏洞修复

    一.设置密码复杂度 [root@localhost ~]# vi /etc/pam.d/system-auth password requisite pam_pwquality.so try_firs ...

  2. Spring boot 无法加载css样式,image解决办法

    Spring boot 无法加载css样式,image解决办法   最近在 给公司做一个系统,使用了springboot框架,同时也遇到了一些大坑 在网上找到了一个好看的模版的,(非前后端的分离)但是 ...

  3. [Oracle19C 数据库管理] 管理存储与表空间

    存储概览 存储的架构 Control File:储存了数据物理存储的信息.存在多个副本来避免单点故障.没有控制文件,数据库无法打开. DATA File: 存储用户与应用的信息,以及元数据与数据字典. ...

  4. 解决每次centos7执行java --version git --version等命令时都要重新source /etc/profile后才能执行,否则找不到命令-转载

      linux mint 我们通常将环境变量设置在/etc/profile这个文件中,这个文件是全局的. /etc/profile:在登录时,操作系 统定制用户环境时使用的第一个文件 ,此文件为系统的 ...

  5. Echarts中国地图下钻

    //各省份的地图json文件 var provinces = { '上海': '/asset/get/s/data-1482909900836-H1BC_1WHg.json', '河北': '/ass ...

  6. VUE学习-组件通信

    vue组件通信 页面传值:$route/${prop} 组件传值: 父组件传值给子组件:参数传值 子组件传值给父组件:给父组件传过来函数传参数:通过插槽的v-slot,绑定参数 组件通信一般分为以下几 ...

  7. idea常用插件 自用

  8. Mac如何卸载软件 Mac如何删除软件

    初次接触Mac苹果电脑的用户可能不知道如何卸载已经装好的应用软件,之前有给大家介绍Mac如何安装软件,现在教大家如何卸载软件,其实非常简单,让我们看看吧: 1.首先我们打开Finder,就是我们Doc ...

  9. TypeScript 元组

    TypeScript 元组 我们知道数组中元素的数据类型都一般是相同的(any[] 类型的数组可以不同),如果存储的元素数据类型不同,则需要使用元组. 元组中允许存储不同类型的元素,元组可以作为参数传 ...

  10. Jquery_001

    jQuery 页面加载初始化的方法有3种 ,页面在加载的时候都会执行脚本,应该没什么区别,主要看习惯吧,本人觉得第二种方法最好,比较简洁. 第一种: $(document).ready(functio ...