使用Colab访问本地文件夹

时间:2018-09-27 15:49:34

标签: python jupyter-notebook google-colaboratory

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

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

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]没有这样的文件或目录:

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

感谢帮助

1 个答案:

答案 0 :(得分:1)

访问本地文件的一种选择是将Colab与Jupyter的本地安装一起使用。此处的说明:

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

另一种选择是将Google Drive安装在本地计算机上,将文件放在此处,然后使用以下代码片段将驱动器文件安装在Colab上:

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

之后,您的云端硬盘文件将出现在内置文件浏览器中。例如, enter image description here

相关问题