将 Python 项目转移到 Google Colab

re*_*e11 4 google-colaboratory

我有一个 python 项目,其中主 .py 文件导入其他 .py 文件,然后使用 .sh 文件为不同的输入参数运行主文件。谁能指导我如何在 Google Colab 上转移和运行整个项目?

小智 10

将您的文件提交到 git 存储库。在新的 google colab 文件中,运行

!git clone <http url of your repo>
Run Code Online (Sandbox Code Playgroud)

然后执行你的程序

!python main.py --foo bar
Run Code Online (Sandbox Code Playgroud)

或者,您可以将您的项目上传到谷歌驱动器,然后从那里导入项目。