繁体   English   中英

ModuleNotFoundError:没有名为“lanenet_model”的模块 - Google Colab

[英]ModuleNotFoundError: No module named 'lanenet_model' - Google Colab

我正在尝试将此存储库用于 google colab 中的lanenet 实现。 克隆存储库后,我想通过调用测试 model:

!python ./tools/test_lanenet.py --weights_path tusimple_lanenet.ckpt.data-00000-of-00001 --image_path test_img.jpg

我在“工具”子文件夹中调用文件“test_lanenet.py”。 此文件尝试导入另一个 python 文件,该文件位于另一个子文件夹 (lanenet_model/lanenet.py) 中:

from lanenet_model import lanenet

但后来我得到了错误

Traceback (most recent call last):
  File "./tools/test_lanenet.py", line 20, in <module>
    from lanenet_model import lanenet
ModuleNotFoundError: No module named 'lanenet_model'
  • 每个子文件夹都有一个__init__.py文件
  • 我已经尝试将子文件夹添加到 pythonpath - 没有用
  • 当我打印 Pythonpath 时,无论是在 colab 命令行中还是在 .py 文件中打印,我都看到我在正确的文件夹中(/content/lanenet-lane-detection)

有人知道我能做些什么来解决这个问题吗?

这是文件夹树: lanenet 文件夹

尝试将要运行的.py文件移动到项目根路径下,然后运行。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM