在“安装"时完全迷失了适用于Python 3的OpenCV/ctypes-opencv [英] Totally Lost on "Installing" OpenCV / ctypes-opencv for Python 3

查看:129
本文介绍了在“安装"时完全迷失了适用于Python 3的OpenCV/ctypes-opencv的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试让 OpenCV 使用Python 3.似乎可以在Python 3中使用的href ="http://code.google.com/p/ctypes-opencv/" rel ="nofollow noreferrer"> ctypes-opencv 弄清楚如何安装"或使任何代码正常工作.我遵循了从少数人那里提到的所有说明,这些人提到了google上的安装,但这些说明似乎都无效,或者我什至无法理解他们提到的基础知识.

I'm trying to get OpenCV working with Python 3. A friend showed me ctypes-opencv that appears to work with Python 3. The problem is I totally can not figure out how to "install" or get any code working. I've followed all instructions I could find from a few people mentioning installs on google and none of those seemed to work or I couldn't even get through the basics that they mentioned.

我只是在研究Python 3附带的IDLE版本.没有IDE.

I am just hacking around with the version of IDLE that came with Python 3. No IDE.

从OpenCV开始:

唯一的 OpenCV 2.1的Windows安装程序是可视的工作室安装程序.我认为这意味着它会安装文件,从而使其更易于在Visual Studio中使用. 但是,这还意味着我不能在Python 3中使用该安装程序吗? ,我尝试将vs安装程序与ctypes-opencv一起使用,如下所示,但出现错误dll不在我的路径中(但我的路径变量确实包含带有dll的OpenCV bin文件夹). 这是错误的方向吗?

The only windows installer for OpenCV 2.1 is a visual studio installer. I assume that means that it installs files that make it easier to use in Visual Studio. However, does it also mean that I can't use that installer with Python 3? I tried the vs installer together with ctypes-opencv as below, and I got errors that the dlls were not in my path (but my path variable did include the OpenCV bin folder with dlls). Is this the wrong direction?

明显的替代方法是自己构建OpenCV.我尝试按照此处的说明进行操作,而我得到的仅仅是按下配置"按钮时,CMake gui应用程序.遵循这些来自堆栈溢出的提示时,情况相同.我怀疑这也是错误的方向,因为我当前未使用CMake配置中列出的任何工具. 这也是错误的方向吗?

The apparent alternative is to build OpenCV myself. I tried following the directions here and all I get is "project files may be invalid" from the CMake gui application when pressing the "Configure" button. Same when following these hints from Stack Overflow. I'm suspicious that this is also the wrong direction since I am not currently using any of the tools that are listed in the CMake configure. Is this also the wrong direction?

下一个ctypes-opencv:

我安装了此文件,安装程序识别出Python3.1,并将其放入site-packages文件夹中.如果我尝试运行演示,它会告诉我dll不在路径中,如上所述.

I installed this and the installer recognizes Python3.1 and puts itself into the site-packages folder. If I try to run demos, it tells me the dlls are not in the path although they are, as mentioned above.

摘要:

我想我通常理解这里的每个部分(代码,编译,dll,导入等),但我不知道所有部分如何组合在一起以及我哪里出了问题.有人可以告诉我这里缺少什么步骤或了解我的意思吗?

I think I generally understand each piece here (code, compile, dll, imports, ...) but I do not know how all the pieces fit together and where I am going wrong. Can someone please tell me what steps or understanding I am missing here?

我觉得我需要读一两本书以填补我对所有这些部分如何组合的理解的空白.我什至都不知道要去哪个领域的书,所以那里的任何建议也将不胜感激.

I get the feeling that I need to be reading a book or two to fill in the holes in my understanding of how all these pieces fit together. I wouldn't even know what area of books to get though so any suggestions there would be appreciated as well.

推荐答案

Christoph Gohlke维护了许多Python软件包的Windows二进制文件,包括2015年6月4日发布的带有Python 3.x绑定的OpenCV 3.0的生产版本:

Christoph Gohlke maintains Windows binaries for many Python packages, including the production version of OpenCV 3.0 with Python 3.x bindings, released 4 June 2015:

http://www.lfd.uci.edu/~gohlke/pythonlibs /#opencv

要安装,只需下载适合您系统的64位或32位.whl文件,然后运行pip install [filename].然后,指令import cv2应该可以在您的Python 3.x解释器中使用.

To install, just download the 64-bit or 32-bit .whl file appropriate for your system, then run pip install [filename]. Then the instruction import cv2 should work in your Python 3.x interpreter.

这篇关于在“安装"时完全迷失了适用于Python 3的OpenCV/ctypes-opencv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆