Mac OS安装OpenCV

时间:2022-06-01 18:44:58

安装环境:Mac OS Sierra,Python 3.5

1、下载安装最新的Anaconda,下载地址:https://www.continuum.io/downloads#macos

2、创建python 环境,虚拟环境使用Python 3.5。

conda create -n myenv python=3.5

3、激活新环境

source activate myenv

4、安装NumPy(opencv依赖于Numpy)

conda install numpy

5、安装anaconda-client命令工具,它用于在Conda搜索OpenCV二进制包

conda install anaconda-client

6、搜索OpenCV 3

anaconda search -t conda opencv3

7、选择搜索结果里支持osx-64的包,例如:https://conda.anaconda.org/menpo

conda install --channel https://conda.anaconda.org/menpo opencv3

8、测试安装

import cv2
print("OpenCV version:")
print(cv2.__version__)

原文:https://gist.github.com/vishwanath79/756185e550556daf19f526984a58a703