【问题标题】:How to clone (or just use) a single file from a Github repository in Google Colab?如何从 Google Colab 的 Github 存储库中克隆(或仅使用)单个文件?
【发布时间】:2021-07-19 13:44:30
【问题描述】:

当然,我可以从 Github 下载文件的“原始”版本,然后将其上传到我的 Colab 笔记本……但是,有没有办法直接在 Colab 中使用单个 Github 文件?

如果我只想使用项目的一些库而不克隆整个存储库,这将很有用。

例如我想在 Colab 中做这样的事情:

from https://raw.githubusercontent.com/ASAROVA/complejos/main/complejos.py import *

# Now I could use any tool from my library "complejos.py"
print(complejo( 0,-4)+complejo( 3,4))
...

【问题讨论】:

    标签: github google-colaboratory


    【解决方案1】:

    你可以这样做

    !wget https://raw.githubusercontent.com/ASAROVA/complejos/main/complejos.py
    from complejos import *
    

    【讨论】:

      猜你喜欢
      • 2019-05-13
      • 2022-07-13
      • 1970-01-01
      • 2020-08-10
      • 2020-06-25
      • 2019-12-31
      • 2020-03-25
      • 2021-12-31
      • 2021-11-18
      相关资源
      最近更新 更多