在MacOS Sierra上安装opencv-3.1.0以与python一起使用

时间:2016-09-29 16:01:02

标签: python macos opencv

我最近升级到MacOS Sierra,我一直处理很多问题(我提到它可能是相关的)。我正在尝试安装opencv-3.1.0以与python 2.7一起使用。这是不可能的。我从here下载了opencv-3.1.0解压缩并运行:

python platforms/osx/build_framework.py osx

来自opencv-3.1.0目录。不想打印所有输出,所以这里只是错误消息。

** BUILD FAILED **


The following build commands failed:
    CompileC osx/build/x86_64-MacOSX/modules/world/OpenCV.build/Release/opencv_world.build/Objects-normal/x86_64/cap_qtkit.o modules/videoio/src/cap_qtkit.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
============================================================
ERROR: Command '['xcodebuild', 'ARCHS=x86_64', '-sdk', 'macosx', '-configuration', 'Release', '-parallelizeTargets', '-jobs', '4', '-target', 'ALL_BUILD', 'build']' returned non-zero exit status 65
============================================================
Traceback (most recent call last):
  File "/Users/christoshadjinikolis/Downloads/opencv-3.1.0/platforms/ios/build_framework.py", line 87, in build
    self._build(outdir)
  File "/Users/christoshadjinikolis/Downloads/opencv-3.1.0/platforms/ios/build_framework.py", line 81, in _build
    self.buildOne(t[0], t[1], mainBD, cmake_flags)
  File "/Users/christoshadjinikolis/Downloads/opencv-3.1.0/platforms/ios/build_framework.py", line 139, in buildOne
    execute(buildcmd + ["-target", "ALL_BUILD", "build"], cwd = builddir)
  File "/Users/christoshadjinikolis/Downloads/opencv-3.1.0/platforms/ios/build_framework.py", line 34, in execute
    retcode = check_call(cmd, cwd = cwd)
  File "/Users/christoshadjinikolis/anaconda/lib/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '['xcodebuild', 'ARCHS=x86_64', '-sdk', 'macosx', '-configuration', 'Release', '-parallelizeTargets', '-jobs', '4', '-target', 'ALL_BUILD', 'build']' returned non-zero exit status 65

非常感谢您的帮助。感谢。

2 个答案:

答案 0 :(得分:1)

在关注帖子here后,我可以通过运行来安装它: brew install opencv3 --HEAD --with-contrib

该问题似乎与QuickTime编解码器有关。您需要指定使用ffmpeg安装库,它应该可以工作。

brew install opencv3 --with-ffmpeg --with-tbb --with-contrib

答案 1 :(得分:0)

尝试:

conda create -n opencv python = 2

source activate opencv

conda install -c conda-forge opencv == 3.1.0