How to Install Python 3 and OpenCV 3 in Mac OSX

We are going to use the terminal for this installation process.

First make sure you have Xcode if not go ahead and download it from app store.

We need to download and install homebrew package manager, open up terminal and copy the script

$ruby -e "$(curl -fsSL </span><a href=""><span style="font-weight: 400;"></span></a><span style="font-weight: 400;">)"

Now that homebrew is installed, let’s download and install python 3, it will take a few minutes.

$ brew install python3

Important OpenCV3 dependency

$pip3 install numpy 

Before downloading OpenCV3 let’s install one of the OpenCV 3 dependencies which usually takes a long time, but this script will shorten the time

$ brew install gcc --force-bottle

Using this script OpenMP might not work but if you want it to work run this script

$ brew reinstall gcc --without-multilib

Installing OpenCV3

$brew tap homebrew/science
$brew install opencv3 --with-contrib --with-ffmpeg --with-tbb --with-qt5 --with-python3

For more options –with-cuda –with-quicktime

Linking apps all apps with brew

$brew linkapps

Now linking with python3

$brew link --force opencv3

Leave a Reply

Your email address will not be published. Required fields are marked *