ImportError: No module named pbas

ImportError: No module named pbas

我正在尝试从 github 应用这个 openCV 项目: https://github.com/andrewssobral/simple_vehicle_counting

我在 linux 上使用了 python 方法,这是我遇到问题的导入行:

from __future__ import print_function
import cv2

import analysis
import tracking
import bgs.pbas as pbas

最后一行是导致此错误的行: the error message

Traceback (most recent call last):
  File "./build/python/demo.py", line 6, in <module>
    import bgs.pbas as pbas
  File "/home/user/Downloads/simple_vehicle_counting-master/build/python/bgs/pbas/__init__.py", line 1, in <module>
    from pbas import *
ImportError: No module named pbas

这是 pbas 初始化文件中的代码:

from pbas import *

# noinspection PyUnresolvedReferences
import pyboostcvconverter as pbcvt

注意:其他导入如第一个 import analysis 工作正常,即使初始化文件非常相似,这是分析的初始化文件:

from analysis import *

# noinspection PyUnresolvedReferences
import cvb
# noinspection PyUnresolvedReferences
import pyboostcvconverter as pbcvt

导入不会查看程序名称 space,因此您必须执行 from bgs.pbas import *。它不知道您已经将 bgs.pbas 导入为 pbas。有关 python 在何处查找要导入的模块的更多信息:

https://docs.python.org/2/tutorial/modules.html#the-module-search-path