在Mac上为python 3.6安装opencv3

时间:2017-04-27 19:53:06

标签: python macos opencv macos-sierra

我想在macOS Sierra上安装opencv3 for python 3.6。我试图通过使用此链接通过自制程序使用它 http://www.pyimagesearch.com/2016/12/19/install-opencv-3-on-macos-with-homebrew-the-easy-way/但我收到此错误

Error: opencv3: Does not support building both Python 2 and 3 wrappers

如何解决这个问题?

3 个答案:

答案 0 :(得分:35)

brew install opencv3 --with-contrib --with-python3 --without-python

答案 1 :(得分:6)

此错误是由this提交引起的。

使用brew edit opencv3,您必须对以下四行进行评论:

if build.with?("python3") && build.with?("python")
  # Opencv3 Does not support building both Python 2 and 3 versions
  odie "opencv3: Does not support building both Python 2 and 3 wrappers"
end

保存并重新运行安装:

brew install opencv3 --with-contrib --with-python3

之后一切都适合我

答案 2 :(得分:1)

我也有同样的问题,我已通过以下方式解决了这个问题:

$ brew edit opencv3

找到以下代码块并注释所有4行:

if build.with?("python3") && build.with?("python")
  # Opencv3 Does not support building both Python 2 and 3 versions
  odie "opencv3: Does not support building both Python 2 and 3 wrappers"
end

最后使用brew install命令安装:

$ brew install opencv3 --with-contrib --with-python3

参考:http://www.pyimagesearch.com/2017/05/15/resolving-macos-opencv-homebrew-install-errors/