“分段错误”在“导入简历”期间在 Mac 操作系统上

发布于 2024-10-20 17:48:28 字数 658 浏览 1 评论 0原文

尝试在我的 Mac 上从源代码编译 opencv。

我有以下 CMakeCache.txt: http://pastebin.com/KqPHjBx0

我制作 ccmake ..,按 c,然后g。 比我做sudo make -j8http://pastebin.com/cJyr1cEd

比我做的sudo make installhttp://pastebin.com/W77syYBj

然后我在 python 中创建 import cv 并使用此堆栈跟踪获取“分段错误”: http://pastebin.com/gegYAK1u

我不知道什么对我有用,请。询问,我会得到它。

Trying to compile opencv on my Mac from source.

I have following CMakeCache.txt:
http://pastebin.com/KqPHjBx0

I make ccmake .., press c, then g.
Than I make sudo make -j8:
http://pastebin.com/cJyr1cEd

Than I make sudo make install:
http://pastebin.com/W77syYBj

And than I make import cv in python and get "Segmentation faul" with this stacktrace:
http://pastebin.com/gegYAK1u

I don't know what could be useful to help me, pls. ask, I'll get it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

囍笑 2024-10-27 17:48:28

我遇到了同样的情况并解决了以下步骤。

在 ccmake(ccmake -G "Unix Makefiles" .) 中,按 t 切换到高级模式。

PYTHON_LIBRARY 值更改为 /opt/local/lib/libpython2.6.dylib 并将 PYTHON_INCLUDE_DIR 更改为 /opt/local/Library/ Frameworks/Python.framework/Versions/2.6/include/python2.6

请注意,具体路径当然取决于您使用的 Python 版本(2.6 或 2.7 等)。另外,如果您使用系统 Python,而不是 MacPorts(位于 /opt 中),那么您可能希望 PYTHON_LIBRARY/usr/lib/libpython2.6.dylib强>

I had a same situation and resolved the following steps.

In ccmake(ccmake -G "Unix Makefiles" .), toggle to the advanced mode pressing t.

change PYTHON_LIBRARY value to /opt/local/lib/libpython2.6.dylib and PYTHON_INCLUDE_DIR to /opt/local/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6.

Note that the specific path depends, of course, what version of Python you are using (2.6 or 2.7 etc.). Also, if you are using the system Python, instead of MacPorts (which is in /opt), then you probably want PYTHON_LIBRARY to be /usr/lib/libpython2.6.dylib

活雷疯 2024-10-27 17:48:28

从您的日志来看,您似乎使用 MacPorts 和 python 2.6。

opencv 在此框架上可以正常编译:

sudo port install  opencv +python26

请务必安装 py26-numpy 以支持基本功能,例如 cv.fromarray

sudo port install py26-numpy

意味着MacPorts 社区已解决您的问题。是最新源码的问题吗?您编译的版本是 macports 使用的版本(opencv 2.2.0)。

您的问题是关于从源代码编译。查看链接到的端口文件,您将能够找到您的问题。要查找 Portfile,请执行:

port file opencv

或直接执行以下操作

sudo port edit  opencv

,这将列出工作 openCV 所需的所有配置标志。

From your logs, you seem to use MacPorts and python 2.6.

opencv will compile fine on this framework:

sudo port install  opencv +python26

be sure to have py26-numpy installed to have support for basic functions such as cv.fromarray :

sudo port install py26-numpy

means that your problem has been solved by the MacPorts community. is it a problem of the latest source? the version you compile is the one (opencv 2.2.0) used by macports.

Your question is about compiling from source. Looking at the portfile linked to that you'll be able to locate your problem. to find the Portfile, do:

port file opencv

or directly

sudo port edit  opencv

this will list all configuration flags necessary for a working openCV.

呆萌少年 2024-10-27 17:48:28

打字:

sudo port select --set python python27

为我修复了段错误。

Typing:

sudo port select --set python python27

fixed the segfault for me.

风铃鹿 2024-10-27 17:48:28

问题很简单,

安装了 OPENCV,

sudo port install  opencv +python26

如果你使用type

sudo port select --set python python26

macports 确实在 ~/usr/lib 中重写了 cv.so如果你使用

sudo port install  opencv +python27

type

sudo port select --set python python27

安装了 OPENCV “bug”是 python2.7 解释器正在尝试打开 python2.6 预编译的二进制文件给出 seg 错误 11 (反之亦然)

opencv 永远不会有的问题是它没有源代码,只有二进制文件,这些二进制文件强烈依赖于构建的编译器(哪个平台等)

The problem is simple, macports did rewrote cv.so in ~/usr/lib

if you installed OPENCV using

sudo port install  opencv +python26

type

sudo port select --set python python26

if you installed OPENCV using

sudo port install  opencv +python27

type

sudo port select --set python python27

The "bug" is that python2.7 interpreter is trying to open python2.6 pre-compiled binary that gives seg fault 11 (or vice versa)

The nevereinding problem with opencv is that it does not have source code, just binaries that are stongly dependent on which compiler there were built on (which platform etc.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文