简体   繁体   中英

python opencv import error for 2.7

I tried to import the cv2 package in windows and I got the error:

>>> import numpy
>>> numpy.version.version
'1.6.1'
>>> import cv2
RuntimeError: module compiled against API version 0xa but this version of numpy is 0x6

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

I have also tried numpy verson 1.11.1 but it didn't work.

You should ensure that you have a single version of numpy installed, assuming you are not working within a virtualenv . Python may still be loading the old numpy package. If that is the case, you will need to remove the old version, or, to make things easier in the long run, use a virtualenv with only the packages you require.

You can check the numpy path:

import numpy
print numpy.__path__

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM