Skip to content

Instantly share code, notes, and snippets.

@reza
Created June 1, 2018 12:31
Show Gist options
  • Save reza/d30fbcd5da0f88f3fb9fb1cb8d6c109d to your computer and use it in GitHub Desktop.
Save reza/d30fbcd5da0f88f3fb9fb1cb8d6c109d to your computer and use it in GitHub Desktop.
Link OpenCv3 (Now part of Homebrew Core) to Python3.6 on Mac OSX High Sierra
~$ brew install opencv3 --with-contrib --with-python3 --without-python
Warning: opencv: this formula has no --with-contrib option so it will be ignored!
Warning: opencv: this formula has no --with-python3 option so it will be ignored!
Warning: opencv: this formula has no --without-python option so it will be ignored!
==> Downloading https://homebrew.bintray.com/bottles/opencv-3.4.1_5.high_sierra.bottle.2.tar.gz
Already downloaded: /Users/reza/Library/Caches/Homebrew/opencv-3.4.1_5.high_sierra.bottle.2.tar.gz
==> Pouring opencv-3.4.1_5.high_sierra.bottle.2.tar.gz
🍺 /usr/local/Cellar/opencv/3.4.1_5: 600 files, 214.8MB
Note: The tricky part is using the Cellar path below rather than /usr/local/opt/opencv/lib/python3.6/site-packages
$ echo /usr/local/Cellar/opencv/3.4.1_5/lib/python3.6/site-packages > /usr/local/lib/python3.6/site-packages/opencv3.pth
site-packages$ python3
Python 3.6.4 (v3.6.4:d48ecebad5, Dec 18 2017, 21:07:28)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment