simpleCV和Raspberry Pi:没有名为simplecv的模块

时间:2017-11-15 21:28:12

标签: python opencv module raspberry-pi simplecv

没有名为SimpleCv的模块

我使用教程链接在我的RPi上安装了simplecv:http://simplecv.readthedocs.io/en/latest/HOWTO-Install%20on%20RaspberryPi.html并安装了svgwrite。

我让simplecv单独工作,但是当运行python文件时,我收到错误:

Traceback (most recent call last):
  File "my-file.py", line 1, in <module>
    from SimpleCv import *
ImportError: No module named SimpleCv

是否与我的Python和simplecv位于不同位置有关?

which python提供:/usr/bin/python

which simplecv提供:/usr/local/bin/simplecv

非常感谢,

2 个答案:

答案 0 :(得分:1)

解决!

对于未来的读者,请务必将from SimpleCV import *

中的所有3个字母大写

愚蠢的错误,以为我尝试了各种资本组合。

答案 1 :(得分:0)

我按照上述步骤操作,但显示:

from SimpleCV import *
pygame 1.9.4.post1
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/SimpleCV/__init__.py", line 3, in <module>
    from SimpleCV.base import *
  File "/usr/local/lib/python2.7/dist-packages/SimpleCV/base.py", line 60, in <module>
    raise ImportError("Cannot load OpenCV library which is required by SimpleCV")
ImportError: Cannot load OpenCV library which is required by SimpleCV

我转到/SimpleCV/base.py目录,并看到以下代码:

try:
    import cv2.cv as cv
except ImportError:
    try:
        import cv
    except ImportError:
        raise ImportError("Cannot load OpenCV library which is required by SimpleCV")

但是如果我在终端中签到,则会得到:

python -c "import cv2; print(cv2.__version__)"

这给了我3.2.0作为输出。因此,它无法在base.py中找到cv,但可以从终端中找到它。知道有什么问题吗?