有没有人曾经在MacOS 10.6上将OpenCV与Python 2.7一起使用? [英] Has anyone ever had OpenCV work with Python 2.7 on MacOS 10.6?

查看:85
本文介绍了有没有人曾经在MacOS 10.6上将OpenCV与Python 2.7一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在过去的6个月中,我一直在努力地尝试使OpenCV在MacOS上与Python一起使用.每次有新版本发布时,我都会重试并失败.我已经尝试过64位和32位,并且都通过macports安装了xcode gcc和gcc.

I've been trying on and off for the past 6 months to get OpenCV to work with Python on MacOS. Every time there's a new release, I try again and fail. I've tried both 64-bit and 32-bit, and both the xcode gcc and gcc installed via macports.

我刚刚花了两天时间,希望最新的OpenCV版本似乎直接包含Python支持.不是.

I just spend the past two days on it, hopeful that the latest OpenCV release, that appears to include Python support directly would work. It doesn't.

我也尝试过使用以下方法,但失败了: http://code.google.com/p/pyopencv/

I've also tried and failed to use this: http://code.google.com/p/pyopencv/

过去几年来,我一直在将OpenCV与C ++或Microsoft C ++/CLI结合使用,但是我很想在Mac上与Python结合使用,因为这是我的主要开发环境.

I've been using OpenCV with C++ or Microsoft C++/CLI for the past few years, but I'd love to use it with Python on a Mac because that is my primary development environment.

我很想听听任何实际上能够使opencv python示例在32位或64位Mac OS 10.6下运行的人的信.

I'd love to hear from anyone who's actually been able to get the opencv python examples to run under Mac OS 10.6, either 32 or 64-bit.

我最后的尝试是按照本页上的说明

My last attempt was to follow the instructions on this page

http://recursive -design.com/blog/2010/12/14/face-detection-with-osx-and-python/

在支持64位的Mac上全新全新安装10.6.

with a clean, fresh install of 10.6 on a 64-bit capable Mac.

我的PYTHONPATH已设置,我可以在其中看到cv库.但是从python导入"cv"失败.

My PYTHONPATH is set, and I can see the cv library in it. But an "import cv" from python fails.

以前,我所获得的最接近的内容(再次,盯着一个干净的,全新的10.6安装)是

Previously, the closest I've ever gotten (again, staring on a clean, fresh 10.6 install) was this:

Python 2.7.1 (r271:86882M, Nov 30 2010, 10:35:34) 
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv
Fatal Python error: Interpreter not initialized (version mismatch?)
Abort trap
thrilllap-2:~ swirsky$ 

我见过很多人在这里回答类似的问题,但从未见过明确的答案.

I've seen a lot of folks answering similar questions here, but have never seen an definitive answer for it.

推荐答案

巧合的是,我昨天做了这个,现在可以了.我使用了此处的指南,该指南位于第2部分,通过自制".

Coincidentally, I did this yesterday, and it works now. I used the guide found here, in Section 2, "Building via Homebrew".

除了,它说.

sudo brew install python     ( the system python is not good enough)

请勿添加此行.这给我带来了很多麻烦. Python 2.6.1在OpenCV上可以完美运行.通过添加该行, homebrew 将安装Python2.7,然后OpenCV将绑定到该版本,而不是默认的系统版本.然后,您可以移动cv.so文件,但仍然会出现版本不匹配错误.

DO NOT ADD THIS LINE. It gave me so much trouble. Python 2.6.1 runs perfectly with OpenCV. By adding that line, homebrew installs Python2.7, and OpenCV will then bind to that version in stead of the default system version. You can then move the cv.so file, but you will still get the version mismatch error.

我不知道您为什么被否决,这是一个合理的问题,也许人们认为您应该将您的问题带给OpenCV人们.

I don't know why you were downvoted, it's a legitimate problem, perhaps people think you should take your problem to the OpenCV people.

这篇关于有没有人曾经在MacOS 10.6上将OpenCV与Python 2.7一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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