1

我正在尝试将 colab 文件作为模块导入,其中包含要在这个新的 colab 文件中使用的函数 (def)。

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

我尝试了所有这些调用:

#!cp "drive/My Drive/Colab Notebooks/Aulas_Cursos/test_module" .
!cp '/content/drive/My Drive/Colab Notebooks/Aulas_Cursos/test_module' .

#import sys
#sys.path.insert(0,'/content/drive/My Drive/ColabNotebooks/Aulas_Cursos')
#sys.path.append('/content/gdrive/My Drive')

import test_module

但我得到了同样的错误:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-42-1a0689a1a9af> in <module>()
----> 1 import test_module

ModuleNotFoundError: No module named 'test_module'

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------
4

0 回答 0