SimpleCV无法在PYCharm中工作

时间:2014-09-15 10:39:27

标签: pycharm simplecv

我安装了SimpleCV和PyCharm的超级包。然后我从PyCharm为SimpleCV安装软件包,并且它成功了。但是,当我从官方网站运行示例程序时,我收到以下消息:

ImportError: Cannot load OpenCV library which is required by SimpleCV

请帮我解决这个问题。

1 个答案:

答案 0 :(得分:0)

最后,我已经弄明白了。

完成SimpleCV安装的超级包后,打开命令提示符并输入以下内容:

SETX PATH C:/Python27/;C:/Python27/Scripts/;C:/<DIR>/build/x86/vc10/bin/;%PATH%
SETX PYTHONPATH C:/<DIR>/opencv/build/python/2.7/;%PYTHONPATH%

将驱动器号和DIR更改为系统上安装SimpleCV的路径(最可能是C:/SimpleCV1.3/files /)。

关闭命令提示符并启动PyCharm并转到设置(Ctrl + Alt + S)并导航到 Project Interpreter ,然后在右侧窗格中单击 绿色添加按钮

PyCharm - Project Interpreter

然后搜索SimpleCV并按如下所示安装包:

Package Installation

关闭PyCharm并从GitHub下载SimpleCV1.3并将 sampleimages 文件夹复制到C:\Python27\Lib\site-packages\SimpleCV\

尝试以下示例代码,它应该可以正常工作。

from SimpleCV import Camera
# Initialize the camera
cam = Camera()
# Loop to continuously get images
while True:
    # Get Image from camera
    img = cam.getImage()
    # Make image black and white
    img = img.binarize()
    # Draw the text "Hello World" on image
    img.drawText("Hello World!")
    # Show the image
    img.show()

希望这会有所帮助!!