简体   繁体   English

在Python 2.7中导入OpenCV 2.4.11时出错

[英]Error when importing OpenCV 2.4.11 in Python 2.7

Whenever I try to import OpenCV in python 2.7 it gives me the error: 每当我尝试在python 2.7中导入OpenCV时,都会出现以下错误:

import cv2
ImportError: DLL load failed: %1 is not a valid Win32 application (When using 

the x64 version), and when I use the x86 version I get x64版本),当我使用x86版本时,

import cv2
ImportError: numpy.core.multiarray failed to import

also, when I try to import numpy.core.multiarray, it says: 另外,当我尝试导入numpy.core.multiarray时,它说:

the API was compiled against numpy version 9 but you have version 7
AttributeError: 'module' object has no attribute 'core'

I am using Windows 10 & OpenCV 2.4.11 (I tried opencv 3.0.0 but it gives the same error) & I used this guide to install opencv http://opencvpython.blogspot.co.uk/2012/05/install-opencv-in-windows-for-python.html 我正在使用Windows 10和OpenCV 2.4.11(我尝试过opencv 3.0.0,但它给出了相同的错误)&我使用了本指南来安装opencv http://opencvpython.blogspot.co.uk/2012/05/install- opencv-in-windows-for-python.html

If anything doesn't work, what the main cause can be is that you should download the 32-bit version of OpenCV (3.x) and Python (2.x) because NumPy is not available in a 64-bit version as of now (2016-07-06). 如果什么都不起作用,则可能的主要原因是您应该下载32位版本的OpenCV(3.x)和Python(2.x),因为自NumPy以来,该版本的64位版本不可用。现在(2016-07-06)。 You can visit Install OpenCV-Python in Windows (for Windows; for another OS reach the page a step behind). 您可以访问在Windows中安装OpenCV-Python (对于Windows;对于其他OS,请到达页面后一步)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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