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. Virtualbox网络设置

    记录一下https://ladybug.top/%E8%BD%AF%E4%BB%B6%E5%AE%89%E8%A3%85&%E9%85%8D%E7%BD%AE/complete-the-net ...

  2. 关于新手在使用git过程中的基本问题--前端开发篇

    1.首先git是什么? git学名叫做分布式版本控制系统. 它能做啥呢?想一想,你在写项目的时候,尤其是大型的协作项目,往往一个项目会经过很多次修改才上线,在这个过程中,你会写项目1.0版.2.0版诸 ...

  3. 检测到远端rexec服务正在运行中

    0.系统 AIX7 1.先备份 /etc/inetd.conf文件 2.vi /etc/inetd.conf vi /etc/inetd.conf ##给原来的行加上注释# # exec .... / ...

  4. linux下项目自动化备份

    #! /bin/bash # 日期: 20220927 # 执行环境: 192.168.25.38 # 功能: 每周自动备份/data下"elasticsearch|project|soft ...

  5. python logging模块学习

    logging 是对程序运行中的日志进行输出记录,用户在程序中设置在哪个地方输出什么信息,方便进行之后问题的排查. logging输出有两种方式:输出至控制台 . 输出至文件 输出至控制台: impo ...

  6. R7-1 判断回文字符串

    R7-1 判断回文字符串 分数 15 全屏浏览题目 切换布局 作者 颜晖-历年试卷 单位 浙大城市学院 输入一个字符串,判断该字符串是否为回文.回文就是字符串中心对称,从左向右读和从右向左读的内容是一 ...

  7. yarn 安装全局包

    yarn 安装全局包,无法使用,需要添加yarn的bin文件夹到环境变量 然后重启一下即可使用,再装其他全局包也可直接使用

  8. elasticSearch(五)--排序

    1.字段值排序  2.多级排序  3.字符串参数排序 GET /_search?sort=date:desc&sort=_score&q=search

  9. iOS新建项目基础设置

    我们新建项目工程的时候一般都需要配置些基本设置,以下是我整理的一些基础配置 一:  pch文件的设置     pch:预编译头文件,这个文件会被编译存储在一个缓存空间,并自动有且只有一次包含在每个文件 ...

  10. SQL_SERVER 2000启动问题

    SQL Server evaluation period has expired解决办法 问题现象: 本地计算机 上的 MSSQLSERVER 服务启动后又停止了.一些服务自动停止,如果它们没有什么可 ...