

There are two ways to resolve this error, as discussed in this StackOverflow thread. Doing this installs OpenCV 3 properly while generating the correct cv2.so bindings for each respective Python version. The first compile handles building OpenCV 3 + Python 2.7 bindings while the second compile generates the OpenCV 3 + Python 3 bindings. To start, OpenCV 3 can be built with Python 2.7 and Python 3 bindings. …because Homebrew can be used to compile OpenCV twice: once for Python 2.7 and then again for Python 3.

I find the error frustrating for two reasons: This error was introduced by the following commit. Error #1: opencv3: Does not support building both Python 2 and 3 wrappersĪssuming you followed my original Homebrew + OpenCV install post, you may have ran into the following error when trying to install OpenCV: $ brew install opencv3 -with-contrib -with-python3 -HEADĮrror: opencv3: Does not support building both Python 2 and 3 wrappers I’ll also provide extra bonus suggestions regarding checking your Python version to help you debug these errors further. In the remainder of this blog post I’ll discuss common errors you may run into when installing OpenCV via Homebrew on your macOS system. Resolving macOS, OpenCV, and Homebrew install errors To learn more about resolving Homebrew errors when installing OpenCV, just keep reading. In an ideal world these instructions will eventually become out of date as the Homebrew formula used to configure and install OpenCV is updated to correct these errors. Today I’m going to share our findings in hopes that it helps you and other PyImageSearch readers install OpenCV via Homebrew on your macOS machines. Myself, as well as PyImageSearch readers Andreas Linnarsson, Francis, and Patrick (see the comments section of the Homebrew OpenCV install post for the gory details) dove into the problem and tackled it head on.

However, a bit of a problem arose a few weeks ago when it was discovered that there were some errors in the most recent Homebrew formula used to build and install OpenCV on macOS.
BREW INSTALL OPENCV ERROR SOFTWARE
Instead, you simply use what are called brew formulas which define how a given package should be automatically configured and installed, similar to how a package manager can intelligently install libraries and software on your system. Using Homebrew allows you to skip manually configuring your build and compiling OpenCV from source. To help you and other PyImageSearch readers get OpenCV installed faster (and with less headaches), I put together a tutorial on using Homebrew to install OpenCV.
BREW INSTALL OPENCV ERROR CODE
Click here to download the source code to this postĪs you undoubtedly know, configuring and installing OpenCV on your macOS machine can be a bit of a pain.
