20

I just installed the opencv 2.4.8 . I'm using python 2.7. I tried to add the opencv lib to python according to this tutorial. but when I tried to import the opencv I got this error:

import cv2
   RuntimeError: module compiled against API version 9 but this version 
   of numpy is 7

   Traceback (most recent call last):
   File "<pyshell#2>", line 1, in <module>
   import cv2
   ImportError: numpy.core.multiarray failed to import

I updated my scipy and numpy packages to its latest version, but I got the same error. How to fix this problem? I googled it but I found some solutions for Mac OS.

I use Windows 7.

3 Answers 3

21

I got this error too. Finally I figure out I should update numpy to the latest version.

The version of numpy in the tutorial is version 7, but now the team is using version 9 (but numpy team name it 1.8 publicly).

For convenience, check here to download the version I use.

To download the latest version, check here.

Sign up to request clarification or add additional context in comments.

4 Comments

I updated the numpy and SciPy but the problem didn't solved :).
It is strange. The update solved my problem, but I encounter link error when compiling the source code. BTW, my platform is windows 7.
Worked for me. I was following this tutorial : opencvpython.blogspot.fr/2012/05/… but updated with the numpy version lesca used
Appears as version 0x9 in error message but is named 1.8 publicly.... ugh ugh ugh they need to do things that make sense.
4

I build OpenCV from source and the problem solved. I used CMake to do that.Don't forget to change the path to the new bin directory in your environment variable.

Comments

0

If you want you can get the 1.9.1 superpack from the following URL.

numpy-1.9.1-win32-superpack-python2.7

This resolved my issue likady split. :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.