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. MxDraw云图平台(H5在线CAD) 网页CAD,网页查看CAD图纸,2023.02.26更新

    下载地址:https://www.mxdraw.com/ndetail_40241.html1. 梦想服务上传CAD文件格式转换,增加转换后的文件例表返回2. 增加绘制图片Tag功能3. 修改在一些图 ...

  2. Qt 字符串相等判断问题

    QString str = "0"; if (QString(param.value.data()) == QStringLiteral("空")) { str ...

  3. python快速制作可视化报表

  4. a[i]之和小于N的含义

    例题 小白月赛 困难卷积 题目 要求一个暴力算是 \(O(n^2)\) 的东西 同时题目保证 \(\sum a[i] \leq 10^7\) 题解 \(\sum a[i] \leq 10^7\) 的含 ...

  5. next_permutation / prev_permutation 用法

    给定输入的序列 a(整数即可,其他无限制条件),next_permutation(a + 1, a + n + 1) 可以求出 a 的关于值的下一个排列,prev_permutation(a + 1, ...

  6. Tomcat异常处理机制

    声明 源码基于Spring Boot 2.3.12中依赖的Tomcat 异常例子 tomcat中返回错误页面目前主要是以下两种情况. 执行servlet发生异常 程序中主动调用response.sen ...

  7. Linux工作中最常用命令整理

    ls 命令:显示指定工作目录下之内容 ls -a # 显示所有文件夹,包含隐藏的. 和.. ls -l # 显示文件的详细信息,包含文件形态,权限,所属,大小,其实就是平常用的 ll ll -h # ...

  8. Dynamics 365 CRM 弹窗 打开自定义页面 Xrm.Navigation.navigateTo Open Web Resource

    在CRM中经常需要打开自定义的HTML界面,而且打开这个界面的时候需要模态窗体,阻止用户填写除了弹窗之外的东西,只能先填写窗体的内容: 这个时候很多人喜欢选择第三方的library去实现模态窗体,但是 ...

  9. 为什么Controller层注入的是Service接口,而不是ServiceImpl实现类

    转自csdn--https://blog.csdn.net/weixin_39565597/article/details/78078728 今天看代码发现,写法和自己理解的java写法不一致,就查找 ...

  10. PyMySQL查询

    title: PyMySQL查询 author: 杨晓东 permalink: PyMySQL查询 date: 2021-10-02 11:27:04 categories: - 投篮 tags: - ...