Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
276 views
in Technique[技术] by (71.8m points)

python 2.7 - OpenCV 2.4.8: module compiled against API version 9

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...