简体   繁体   English

OpenCV Python 导入模块

[英]OpenCV Python Import Module

I'm having some issues.我有一些问题。 I've installed OpenCV 2.3 on an ec2 ubuntu instance - and compiled with the necessaries for python integration.我已经在 ec2 ubuntu 实例上安装了 OpenCV 2.3 - 并使用 python 集成的必需品进行了编译。 I realised that python was behind so upgraded that to 2.6 afterwards.我意识到 python 落后所以后来升级到 2.6。

All should be good.一切都应该很好。 However, running a basic.py script and calling OpenCV in isn't working.但是,运行 basic.py 脚本并调用 OpenCV 不起作用。 Forgive me if this is a basic error, I'm new to OpenCV.如果这是一个基本错误,请原谅我,我是 OpenCV 的新手。

SCRIPT IS:-脚本是:-

import cv
cv.SaveImage("foo.jpg", cv.LoadImage("foo.png"))

WHEN RUN IT RESPONDS:-运行时响应:-

Traceback (most recent call last):
  File "tester.py", line 1, in <module>
    import opencv
ImportError: No module named opencv

Am I doing something silly here.我在这里做傻事吗。 I've tried looking at this idea that some have harped on about, of moving stuff to different to different dirs - but not found the files the talk of, specifically finding opencv.so and moving it to python dirs.我试过看看这个想法,有些人一直在谈论,将东西移动到不同的目录 - 但没有找到谈论的文件,特别是找到 opencv.so 并将其移动到 python 目录。

Any advice gratefully received.感激地收到任何建议。

You'll need to rebuild OpenCV against the new Python you've installed.您需要根据已安装的新 Python 重建 OpenCV。

python2.6 setup.py install

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

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