简体   繁体   English

OpenCV的Python - OS X.

[英]OpenCV's Python - OS X

I get the following error while building OpenCV on OS X 10.5 (intel): 在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

While running ./configure --without-python everything is ok. 在运行./configure --without-python时一切正常。 Another strange thing is that when I used Python 2.4.5 or 2.5.1 everything has built ok, the problem occured after switching to Python Framework 2.5.2 另一个奇怪的事情是,当我使用Python 2.4.5或2.5.1时,所有内容都已构建好,切换到Python Framework 2.5.2后出现问题

It seems a little weird that it is warning about different architectures when looking for /Developer/SDKs/MacOSX10.4u.sdk while linking - can you give us some more detail about your build environment (version of XCode, GCC, Python, $PATH etc) 在链接时查找/Developer/SDKs/MacOSX10.4u.sdk时警告不同的架构似乎有点奇怪 - 你能否给我们一些关于你的构建环境的更多细节(XCode,GCC,Python,$ PATH的版本)等等)

Alternatively, won't any of the OpenCV binaries available work for you? 或者,任何OpenCV二进制文件都不适合您吗?

/Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib is just a link to /usr/local/lib after deleting files that caused the warnings I'm getting : /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: ... `

And these files are created by make. 这些文件是由make创建的。

gcc: i686-apple-darwin9-gcc-4.0.1 gcc:i686-apple-darwin9-gcc-4.0.1

$PATH: $ PATH:

/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 (latest) XCode 3(最新)

Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04) - MacPython from python.org (tried to downgrade and use it instead of 2.5.2, but that doesn't work anymore...) Python 2.5.1(r251:54869,2007年4月18日,22:08:04) - 来自python.org的MacPython(尝试降级并使用它而不是2.5.2,但这不再起作用......)

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

I didn't find any Python OpenCV binaries for OS X. I've tried to make it while setting python2.4 or 2.5 from macports as default and it compiles and installs, but when I try to import there is a bus error or Fatal Python error Interpreter not initialized (version mismatch?) and it quits. 我没有为OS X找到任何Python OpenCV二进制文件。我试图在默认情况下从macports设置python2.4或2.5时进行编译和安装,但是当我尝试导入时出现总线错误或致命错误Python错误解释器未初始化(版本不匹配?)并退出。

Ok, I kind of worked it out 好的,我有点努力了

It needs to be compiled with python from macports or whatever. 它需要使用python从macports或其他任何东西编译。 Then I need to run /System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5 (this is my previous python version) and there OpenCV just works. 然后我需要运行/System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5 (这是我之前的python版本)并且OpenCV正常运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM