mac install opencv with python

来源:互联网 发布:人工智能 时时彩 编辑:程序博客网 时间:2024/05/16 12:31

Step1:Install Homebrew

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew update

Step2: Install Python 2.7 and Python 3 using Homebrew

$ brew install python python3
$ brew linkapps python$ brew linkapps python3
$ which python$ which python3

Step3: Install OpenCV 3 with Python bindings on macOS using Homebrew

if use python as programming language

$ brew tap homebrew/science$ brew install opencv3 --with-contrib --with-python3 --HEAD

if use java as programming language

brew install opencv3 --HEAD --with-contrib --with-java

Step4: bash_profile

create bash_profile in home address

touch ~/.bash_profileopen ~/.bash_profile

add sentence in this file

# Homebrewexport PATH=/usr/local/bin:$PATH

save it in terminal

source .bash_profile

in new terminal

pkg-config --libs opencvpkg-config --cflags opencv

Reference

http://www.jianshu.com/p/3d149f167b41
http://www.pyimagesearch.com/2016/12/19/install-opencv-3-on-macos-with-homebrew-the-easy-way/ (太复杂)
Start with brew doctor which will show you errors with your brew setup.
http://www.jianshu.com/p/b9b35db5f084 (fix error)

Follow up1: xcode and python

https://vandadnp.wordpress.com/2012/07/05/building-and-running-python-scripts-with-xcode-4-x/
point: Cmd+Shift+G to “Go to Folder” and then I type in /usr/bin/python

Follow up2: opencv and java

http://opencv-java-tutorials.readthedocs.io/en/latest/01-installing-opencv-for-java.html#introduction-to-opencv-for-java

原创粉丝点击