在 mac 上为 python 3.6 安装 opencv3

install opencv3 on mac for python 3.6

我想在 macOS Sierra 上为 python 3.6 安装 opencv3。我试图通过自制软件使用它 link 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

如何解决?

此错误是由 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

在那之后一切都对我有用

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

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

$ brew 编辑 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/