我想在当前文件目录中导入一个名为 DataGenerator 的类:/content/gdrive/My Drive/mrcnn_fire/ssd/python_files/object_detection_2d_data_generator.py我导入如下:from content.gdrive.My Drive.mrcnn_fire.ssd.python_files.object_detection_2d_data_generator import DataGenerator它给了我以下错误:File "<ipython-input-3-7d861f8abbeb>", line 4 from content.gdrive.My Drive.mrcnn_fire.ssd.python_files.object_detection_2d_data_generator import DataGenerator ^SyntaxError: invalid syntax
2 回答
Qyouu
TA贡献1786条经验 获得超11个赞
你也可以这样尝试:
# object_detection_2d_data_generator.py
import sys
sys.path.insert(0, '/content/gdrive/My Drive/mrcnn_fire/ssd/python_files')
from object_detection_2d_data_generator import DataGenerator
杨魅力
TA贡献1811条经验 获得超6个赞
您可以通过以下方式导入它:
DataGenerator = __import__("content/gdrive/My Drive/mrcnn_fire/ssd/python_files/object_detection_2d_data_generator/DataGenerator")
- 2 回答
- 0 关注
- 176 浏览
添加回答
举报
0/150
提交
取消