• Register
0 votes

Problem :

I have recently installed the opencv 2.4.8 . I am also using python 2.7. I have tried to add my opencv lib to the python according to the tutorial however when I wanted to import my opencv I encountered below 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 have already tried to update my scipy and numpy packages to the latest version, but still I got the above error. How can I fix above problem? I researched on still I am unable to find the solutions. Currently I use Windows 7.

6 5 3
7,540 points

1 Answer

0 votes

Solution :

I got the same error too in the recent past. Finally I figure out that I should update my numpy to the latest version.

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

For yours convenience please check here to download the version that I use.

Also to download the latest version, please check here.

I hope it solves your issue.

9 7 4
38,600 points

Related questions

0 votes
1 answer 310 views
Problem : I am trying to execute below commands. import numpy as np import cv But I am getting following error on my console: >>> runfile('/Users/isaiahnields/.spyder2/temp.py', wdir='/Users/isaiahnields/.spyder2') RuntimeError: module compiled against API version a but this ... it is not working. I had added cv.py to the python2.7 folder in Spyder-Py2 is there anything else I need to add?
asked Dec 4, 2019 alecxe 7.5k points
0 votes
1 answer 561 views
Problem : I want to learn the Machine Learning but I am unabe to resolve below error. My Specs : · Mac High Sierra 10.13.2 · Python3.4.5 · Numpy1.13.3 Used below Command: $ python3 -c "import jupyter, matplotlib, numpy, pandas, scipy, sklearn" I am ... to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace --force' to build the C extensions first.
asked Dec 4, 2019 alecxe 7.5k points
0 votes
1 answer 25 views