1. 程式人生 > >mac os, python 3.7 安裝opencv3

mac os, python 3.7 安裝opencv3

感想

programmer在做事情的時候,最厭煩的就是安裝這個安裝那個了,我也是,然後我發現安裝opencv到python3也不是很容易,我這裡分享一下我的簡潔方法。

 

首先你要安裝xcode和home brew,xcode直接在應用商店裡面找哈,homebrew安裝如下:

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

opencv for python3 安裝

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

然後就成功了哈。我的輸出為:

➜  ~ python3
Python 3.7.0 (default, Oct  2 2018, 09:20:07)
[Clang 10.0.0 (clang-1000.11.45.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>>

參考文獻

[1].Install OpenCV 3 on macOS with Homebrew (the easy way). https://www.pyimagesearch.com/2016/12/19/install-opencv-3-on-macos-with-homebrew-the-easy-way/