Mac下安装opencv并配置Python3 支持

前提你已经在Mac上安装了Python3

1,安装opencv

brew up

brew install opencv

2,

homebrew安装的程序位置都在 下面。

/usr/local/Cellar/

所以我们需要找到的就是opencv的cv2*.so文件,我的文件路径为:

/usr/local/Cellar/opencv/3.3.1_1/lib/python3.6/site-packages/cv2.cpython-36m-darwin.so

3,opencv和python3环境关联

终端进入目录:/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages

执行:

ln -s /usr/local/Cellar/opencv/3.3.1_1/lib/python3.6/site-packages/cv2.cpython-36m-darwin.so cv2.so

4,测试是否成功

  1. >>> import cv2
  2. >>> cv2.__version__
原文链接:,转发请注明来源!

发表评论