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

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

问题描述

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

执行此操作时,它会给我一个错误:

  import os输出= [如果os.path.isdir(os.path.join(main_folder,dI)),则os.listdir(main_folder)中dI的dI]]打印(输出) 

[Errno 2]没有这样的文件或目录:

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

感谢帮助

解决方案

访问本地文件的一种方法是在本地安装的Jupyter中使用Colab.这样做的说明在这里:

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:/.../.../

Thanks for help

解决方案

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天全站免登陆