【问题标题】:OpenCV's Python - OS XOpenCV 的 Python - OS X
【发布时间】:2010-09-23 20:50:03
【问题描述】:

在 OS X 10.5 (intel) 上构建 OpenCV 时出现以下错误:

ld: warning in .libs/_cv_la-_cv.o, file is not of required architecture
ld: warning in .libs/_cv_la-error.o, file is not of required architecture
ld: warning in .libs/_cv_la-pyhelpers.o, file is not of required architecture
ld: warning in .libs/_cv_la-cvshadow.o, file is not of required architecture
ld: warning in ../../../cv/src/.libs/libcv.dylib, file is not of required architecture
ld: warning in /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libcxcore.dylib, file is not of required architecture
Undefined symbols for architecture i386:
"_fputs$UNIX2003", referenced from:
  _PySwigObject_print in _cv_la-_cv.o
  _PySwigPacked_print in _cv_la-_cv.o
  _PySwigPacked_print in _cv_la-_cv.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
lipo: can't open input file: /var/folders/Sr/Srq9N4R8Hr82xeFvW3o-uk+++TI/-Tmp-//cchT0WVX.out (No such file or directory)
make[4]: *** [_cv.la] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

运行 ./configure --without-python 时一切正常。另一个奇怪的是,当我使用 Python 2.4.5 或 2.5.1 时一切正常,切换到 Python Framework 2.5.2 后出现问题

【问题讨论】:

  • 您使用的是哪个 python 发行版?也许它没有用 OpenCV 测试过。你有没有考虑过使用macports来构建python和opencv?

标签: python macos opencv


【解决方案1】:

在链接时寻找 /Developer/SDKs/MacOSX10.4u.sdk 时,它会警告不同的架构,这似乎有点奇怪 - 你能否给我们一些关于你的构建环境的更多细节(XCode、GCC、Python 的版本, $PATH 等)

或者,任何可用的 OpenCV 二进制文件都不适合您吗?

【讨论】:

    【解决方案2】:

    /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib 只是到 /usr/local/lib 的链接 删除导致我收到警告的文件后:

    ld: warning in .libs/_cv_la-_cv.o, file is not of required architecture
    ld: warning in .libs/_cv_la-error.o, file is not of required architecture
    ld: warning in .libs/_cv_la-pyhelpers.o, file is not of required architecture
    ld: warning in .libs/_cv_la-cvshadow.o, file is not of required architecture
    ld: warning in ../../../cv/src/.libs/libcv.dylib, file is not of required architecture
    ld: warning in /Users/Pietras/opencv/cxcore/src/.libs/libcxcore.dylib, file is not of required architecture
    Undefined symbols for architecture i386: ... `
    

    这些文件是由make创建的。

    gcc: i686-apple-darwin9-gcc-4.0.1

    $路径:

    /Library/Frameworks/Python.framework/Versions/Current/bin:/Library/Frameworks/Python.framework/Versions/Current/bin:/sw/bin:/sw/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/AVRMacPack/bin:/usr/X11R6/bin
    

    XCode 3(最新)

    Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04) - 来自 python.org 的 MacPython (试图降级并使用它而不是 2.5.2,但这不再起作用了......)

    which python
    /Library/Frameworks/Python.framework/Versions/Current/bin/python
    

    我没有找到任何适用于 OS X 的 Python OpenCV 二进制文件。 我尝试将 macports 中的 python2.4 或 2.5 设置为默认值并进行编译和安装,但是当我尝试导入时,出现总线错误或致命 Python 错误解释器未初始化(版本不匹配?) 然后它就退出了。

    【讨论】:

      【解决方案3】:

      好的,我已经解决了

      它需要使用来自 macports 或其他的 python 编译。然后我需要运行/System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5(这是我以前的python 版本),OpenCV 就可以工作了。

      【讨论】:

        猜你喜欢
        • 2016-12-06
        • 1970-01-01
        • 2011-01-20
        • 2013-11-09
        • 1970-01-01
        • 2016-05-07
        • 2016-01-20
        • 1970-01-01
        • 2013-05-16
        相关资源
        最近更新 更多