简体   繁体   English

无法在Windows x64系统上使用OpenCV安装Python

[英]Not able to install Python with OpenCV on windows x64 system

I am trying to install python on my system but facing some issues. 我正在尝试在系统上安装python,但遇到一些问题。

I have installed OpenCV 3.0.0 for Windows x64 bit system and now i am trying to install python 2.7.5 on my system and i also have installed numpy 1.7.1. 我已经为Windows x64位系统安装了OpenCV 3.0.0,现在我正在尝试在系统上安装python 2.7.5,并且我还安装了numpy 1.7.1。

Then i copied 'cv2.pyd' from my OpenCV folder to python folder, now in order to configure them i have to import cv2 file but this error is coming when i try that. 然后我将“ cv2.pyd”从我的OpenCV文件夹复制到python文件夹,现在为了配置它们,我必须导入cv2文件,但是当我尝试这样做时会出现此错误。

在此处输入图片说明

can anyone help me in this i am new in this. 谁能帮助我,我是新来的。 Shall i try to work with latest version of python and numpy for my windows x64 system? 我可以在Windows x64系统上尝试使用最新版本的python和numpy吗?

Thanks 谢谢

Here's a complete way of installing OpenCV with Python 这是使用Python安装OpenCV的完整方法

  1. Download: Python-2.7.11 from https://www.python.org/downloads numpy-1.8.0-win32-superpack-python2.7.exe from https://sourceforge.net/projects/numpy/files/NumPy/1.8.0/ matplotlib-1.3.0.win32-py2.7.exe from https://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.3.0/ 下载:来自https://www.python.org/downloads的 python-2.7.11 numpy-1.8.0-win32-superpack-python2.7.exe来自https://sourceforge.net/projects/numpy/files/NumPy来自https://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.3.0/的 /1.8.0/ matplotlib-1.3.0.win32-py2.7.exe
  2. Install Python-2.7.11 安装Python-2.7.11
  3. Copy the .exe of numpy, matplotlib and opencv and paste them in C:\\Python27 复制numpy,matplotlib和opencv的.exe并将其粘贴到C:\\ Python27
  4. Run numpy-1.8.0-win32-superpack-python2.7.exe 运行numpy-1.8.0-win32-superpack-python2.7.exe
  5. Run matplotlib-1.3.0.win32-py2.7.exe 运行matplotlib-1.3.0.win32-py2.7.exe
  6. In Python Idle, execute import numpy to ensure that numpy is correctly installed. 在Python Idle中,执行import numpy以确保正确安装了numpy。
  7. Run opencv-3.1.0.exe 运行opencv-3.1.0.exe
  8. Goto opencv/build/python/2.7/x86 folder. 转到opencv / build / python / 2.7 / x86文件夹。 Copy cv2.pyd to C:/Python27/lib/site-packeges. 将cv2.pyd复制到C:/ Python27 / lib / site-packeges。
  9. copy ffmpeg zip folder to C:\\ 将ffmpeg zip文件夹复制到C:\\
  10. Extract ffmpeg in C:\\ffmpeg 在C:\\ ffmpeg中提取ffmpeg
  11. Copy extracted ffmpeg folder to C:\\Python27 将提取的ffmpeg文件夹复制到C:\\ Python27
  12. Locate opencv_ffmpeg310_64.dll and opencv_ffmpeg310.dll and copy these at C:\\Python27 (Most likely opencv_ffmpeg310.dll is more important than opencv_ffmpeg310_64.dll but not sure. So copy both.) 找到opencv_ffmpeg310_64.dll和opencv_ffmpeg310.dll并将它们复制到C:\\ Python27(最有可能的opencv_ffmpeg310.dll比opencv_ffmpeg310_64.dll更重要,但不确定,因此请复制两者。)
  13. Go to system Variables and set path C:\\Python27; 转到系统变量并设置路径C:\\ Python27; C:\\Python27\\ffmpeg\\bin C:\\ Python27 \\ ffmpeg \\ bin

After lots of research and struggle i found out what the issue was. 经过大量研究和努力,我发现了问题所在。

My system is Windows x64 bit but this python and numpy most of the times don't work well with Windows x64 bit systems. 我的系统是Windows x64位,但是大多数情况下,此python和numpy不适用于Windows x64位系统。

So i first i configured my OpenCV as x86, though my system is x64 bit. 所以我首先将OpenCV配置为x86,尽管我的系统是x64位。 After that i download 32 bit python and numpy and configured the same with OpenCV and it worked very well. 之后,我下载了32位python和numpy并使用OpenCV进行了配置,并且效果很好。

Thanks ! 谢谢 !

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

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