0
votes

So I was trying to follow the steps from the link below http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_setup/py_setup_in_windows/py_setup_in_windows.html#install-opencv-python-in-windows

Below Python packages are to be downloaded and installed to their default locations.

1.1. Python-2.7.x.

1.2. Numpy.

1.3. Matplotlib (Matplotlib is optional, but recommended since we use it a lot in our tutorials).

Install all packages into their default locations. Python will be installed to C:/Python27/.

After installation, open Python IDLE. Enter import numpy and make sure Numpy is working fine.

Download latest OpenCV release from sourceforge site and double-click to extract it.

Goto opencv/build/python/2.7 folder.

Copy cv2.pyd to C:/Python27/lib/site-packages.

Open Python IDLE and type following codes in Python terminal.

import cv2

print cv2.version

If the results are printed out without any errors, congratulations !!! You have installed OpenCV-Python successfully.

When I try to type "import cv2" I get this error: RuntimeError: module compiled against API version 0xa but this version of numpy is 0x7

Traceback (most recent call last): File "", line 1, in import cv2 ImportError: numpy.core.multiarray failed to import

What could this be?

3

3 Answers

0
votes

I ended up solving my own problem using pip-installer. The link is at the bottom. What ended up happening was I was trying to install Numpy 1.8, when I should have let pip-installer "update" to the actual correct version necessary.

https://github.com/BurntSushi/nfldb/wiki/Python-&-pip-Windows-installation

along with the command I used: pip install --upgrade numpy

This will allow for the correct version of Numpy to be installed.

0
votes

Read the error information carefully, the opencv base on version 0xa compiled, but the found numpy version is 0x7.

When I try to type "import cv2" I get this error: RuntimeError: module compiled against API version 0xa but this version of numpy is 0x7

You may need upgrade the numpy module to the latest version.

pip install numpy --upgrade

0
votes

it worked for me too.Thanks..just giving further illustaration.

my numpy was on 1.7.1 and it was giving error while doing import cv2.

I downloaded/copied the pip data from the above mentioned link, renamed as get-pip.py in the Scripts folder under Python27. Once done, I ran python get-pip.py command(u need to set the env variable for Python so that it can be executed from under Script folder where the get-pip.py file is kept) through the windows command terminal. This installad the pip to my system.

After then in the cmd terminal, went to Scripts folder and ran the cmd pip install --upgrade numpy which then Successfully installed numpy-1.13.1. It was giving some problem due to previous numpy version, which i uninstalled through the control panel. Cheers,