将python模块导入colab-ModuleNotFoundError

时间:2020-09-19 18:34:14

标签: python google-colaboratory modulenotfounderror

我正在尝试将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.
---------------------------------------------------------------------------

0 个答案:

没有答案