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. df -T 和 du 统计的内存不一致

    1.问题原因 客户反馈,df -T 查看到挂载到flash文件的emmc使用了6G左右,但是在flash下看到du -h 只用了2G左右,客户疑问,还有4G去哪儿了? 2.问题怀疑方向 1.怀疑启动阶 ...

  2. QString的一些使用技巧

    简介 QString 字符串被每个GUI程序所使用,不仅是用户界面,还有数据结构. C++原生提供两种字符串: 传统的C风格以'\0'结尾的字符数组和std::string类.与这些不同,QStrin ...

  3. 根据两点经纬度计算两点间距离 js

    getDistance(lat1, lng1, lat2, lng2) { let radLat1 = lat1 * Math.PI / 180.0; let radLat2 = lat2 * Mat ...

  4. python 的钩子函数

    一.什么是钩子函数 hook函数就是在一定条件下才会执行的函数,将自己实现的函数挂载到挂载点上 1. hook函数:就是我们自己实现的函数,函数类型与挂载点匹配(返回值,参数列表)2. 挂接:也就是h ...

  5. 怎么才能卸载inventor?完全彻底卸载删除干净inventor各种残留注册表和文件的方法和步骤

    怎么才能卸载inventor?完全彻底卸载删除干净inventor各种残留注册表和文件的方法和步骤.如何卸载inventor呢?有很多同学想把inventor卸载后重新安装,但是发现inventor安 ...

  6. flannel提供的3种后端实现

    UDP(flanneld封装和解封装UDP) 实现原理 缺点(性能最差) UDP模式,封装和解封装的对象是三层IP包,提供三层的Overlay网络,是Flannel最早支持的一种方式,也是性能最差的一 ...

  7. [NOIP1999 提高组] 旅行家的预算

    洛咕 题意:一个旅行家想驾驶汽车以最少的费用从一个城市到另一个城市(假设出发时油箱是空的).给定两个城市之间的距离 \(D_1\).汽车油箱的容量 \(C\)(以升为单位).每升汽油能行驶的距离 \( ...

  8. .net基础—多线程(一)

    基本概念 进程 打开任务管理器,从任务管理器里面可以看到当前所有正在运行的进程.那么究竟什么是进程呢? 进程(Process)是操作系统中的一个基本概念,它包含着一个运行程序所需要的资源.一个正在运行 ...

  9. Codeforces Round #781 (Div. 2) - D. GCD Guess

    GCD + 位运算 [Problem - 1665D - Codeforces](https://codeforces.com/problemset/problem/1627/D) 题意 交互题,有一 ...

  10. Joseph Problem With Passwords In Java

    问题描述: 编号为1,2,......,n的n个人(每个人的信息有编号.姓名和密码三项)按照顺时针方向围坐一圈, 每个人有且只有一个密码(正整数,密码用随机方式赋值,范围1-15).一开始任选一个正整 ...