简体   繁体   中英

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. I realised that python was behind so upgraded that to 2.6 afterwards.

All should be good. However, running a basic.py script and calling OpenCV in isn't working. Forgive me if this is a basic error, I'm new to 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.

Any advice gratefully received.

You'll need to rebuild OpenCV against the new Python you've installed.

python2.6 setup.py install

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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