【问题标题】:Can't view Github Repos after cloning them into Colaboratory将 Github Repos 克隆到 Colaboratory 后无法查看
【发布时间】:2018-07-08 18:37:13
【问题描述】:

我将一个 Github 存储库克隆到 Colaboratory,尽管它已被克隆,但我无法在该特定文件夹中查看它。我更改为“驱动器”作为我的工作目录,但我不知道驱动器上的哪个目录。我移动到驱动器文件夹并查看了它的内容,它存在于驱动器文件夹中。请告诉我哪个是 Google Drive 上的驱动器文件夹。提前致谢。

【问题讨论】:

  • 请清楚说明您的要求

标签: python google-colaboratory google-drive-shared-drive


【解决方案1】:

首先,在 Colab 中挂载 Google Drive,如下:

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

输入授权码以提供对您云端硬盘的访问权限。


接下来,cd 到你想要的文件夹:

%cd '/content/drive/My Drive/[folder name]'


最后,git clone GitHub 仓库:

!git clone https://github.com/example/example_repo.git


您现在应该能够在云端硬盘中看到存储库及其内容。使用!pwd!ls 检查您是否在正确的目录中。

【讨论】:

    【解决方案2】:

    Colab 在云中的新机器上运行。如果你在 Colab 中 git clone,它不会出现在 Gdrive 中。您需要按照此处所示安装它。

    How to Upload Many Files to Google Colab?

    【讨论】:

      【解决方案3】:

      尝试将运行类型更改为GPU,然后重试克隆。

      我在使用默认 Jupyter 笔记本时遇到了同样的问题。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2016-09-25
        • 2021-01-28
        • 1970-01-01
        • 1970-01-01
        • 2012-07-07
        • 2016-10-09
        • 1970-01-01
        相关资源
        最近更新 更多