使用 Colab 访问本地文件夹 [英] Access to local folder with Colab

查看:99
本文介绍了使用 Colab 访问本地文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 Colab 上制作一个深度学习系统.我的数据存储在笔记本电脑的本地文件夹中,但我不知道如何访问.

当我这样做时,它给了我一个错误:

导入操作系统output = [dI for dI in os.listdir(main_folder) if os.path.isdir(os.path.join(main_folder,dI))]打印(输出)[Errno 2] 没有那个文件或目录:

main_folder 是本地路径:C:/.../.../

解决方案

访问本地文件的一个选项是将 Colab 与本地安装的 Jupyter 一起使用.操作说明如下:

I want to make a deep learning system on Colab. My data are stored in a local folder on my laptop but I don't know how to acceed it.

When I do this, it gives me an error :

import os
output = [dI for dI in os.listdir(main_folder) if os.path.isdir(os.path.join(main_folder,dI))]
print (output)

[Errno 2] No such file or directory:

main_folder is a local path : C:/.../.../

解决方案

One option to access local files is to use Colab with a local install of Jupyter. Instructions to do that are here:

http://research.google.com/colaboratory/local-runtimes.html

Another option is to install Google Drive on your local machine, put the files there, and then mount your Drive files on Colab using the following snippet:

from google.colab import drive
drive.mount('/content/gdrive')

After that, your Drive files will appear in the built-in file browser. For example,

这篇关于使用 Colab 访问本地文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆