• 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

Please log in or register to answer this question.

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 830 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 1K 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
1 vote
1 answer 2 views
Problem: How can I solve this runtime error? Module compiled against API version 0xa but this version of numpy is 0x9.
asked Mar 30 PkGuy 13.1k points
0 votes
1 answer 45 views
0 votes
1 answer 74 views
Problem: error: (-215:assertion failed) !empty() in function 'cv::cascadeclassifier::detectmultiscale'
asked Feb 19 Lucky Guy 1.5k points
0 votes
1 answer 7 views
Problem: Please help me that how to install pip for python 2.7?
asked Mar 18 Ifra 24.4k points
0 votes
1 answer 2 views
Problem: Is anyone available to assist me and resolve this issue? Modulenotfounderror: no module named 'google.cloud'
asked 4 days ago Ifra 24.4k points
0 votes
1 answer 994 views
Problem: I have recently started learning Python so I have only fundamental knowledge in Python. Please find below my Transaction class for your reference: class Transaction(object):     def __init__(self, company, num, price, date, is_buy):         self.company = company         ... Python and because of lockdown I am unable to find any help to fix this issue. So I am posting my question here.
asked Aug 10, 2020 Raphael Pacheco 4.9k points