“分段错误”在“导入简历”期间在 Mac 操作系统上
尝试在我的 Mac 上从源代码编译 opencv。
我有以下 CMakeCache.txt: http://pastebin.com/KqPHjBx0
我制作 ccmake ..
,按 c
,然后g
。 比我做sudo make -j8
: http://pastebin.com/cJyr1cEd
比我做的sudo make install
: http://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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我遇到了同样的情况并解决了以下步骤。
在 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 pressingt
.change
PYTHON_LIBRARY
value to/opt/local/lib/libpython2.6.dylib
andPYTHON_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
从您的日志来看,您似乎使用 MacPorts 和 python 2.6。
opencv
在此框架上可以正常编译:请务必安装
py26-numpy
以支持基本功能,例如cv.fromarray
:意味着MacPorts 社区已解决您的问题。是最新源码的问题吗?您编译的版本是 macports 使用的版本(opencv 2.2.0)。
您的问题是关于从源代码编译。查看链接到的端口文件,您将能够找到您的问题。要查找 Portfile,请执行:
或直接执行以下操作
,这将列出工作 openCV 所需的所有配置标志。
From your logs, you seem to use MacPorts and python 2.6.
opencv
will compile fine on this framework:be sure to have
py26-numpy
installed to have support for basic functions such ascv.fromarray
: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:
or directly
this will list all configuration flags necessary for a working openCV.
打字:
为我修复了段错误。
Typing:
fixed the segfault for me.
问题很简单,
安装了 OPENCV,
如果你使用type
macports 确实在 ~/usr/lib 中重写了 cv.so如果你使用
type
安装了 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
type
if you installed OPENCV using
type
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.)