MacOS X安装OpenCV3.2说明介绍
程序员文章站
2022-03-17 18:44:55
...
windows平台和linux平台安装参见 官方文档:http://docs.opencv.org/3.2.0/da/df6/tutorial_py_table_of_contents_setup.html
mac下安装在官方平台没找到。参考:
https://www.learnopencv.com/install-opencv-3-on-yosemite-osx-10-10-x/
核心指令就两句,超简单。
brew tap homebrew/science brew install opencv3
但是也遇到了一堆问题。记录过程如下:
1.
brew install opencv3
报错:
Error: You must `brew link openexr` before homebrew/science/opencv3 can be installed
2. 以为没有装openexr, 查了一下http://www.openexr.com/ 觉得不装也可以,刚好有 --without-openexr这个选项,因此:
brew install opencv3 --without-openexr
报错:
Error: The `brew link` step did not complete successfully The formula built, but is not symlinked into /usr/local Could not symlink share/aclocal/cmake.m4/usr/local/share/aclocal is not writable. You can try again using: brew link cmake ………………
3. 那就按照提示吧:
brew link pkg-config
报错:
Error: Could not symlink share/aclocal/pkg.m4/usr/local/share/aclocal is not writable.
4. 哦,没权限。那么:
sudo brew link pkg-config
报错:
Error: Running Homebrew as root is extremely dangerous and no longer supported.
5. 原来不允许,那么只好改文件夹权限了
whoami# 下面两个命令中的‘whoami’用刚才命令的输出代替sudo chown -R 'whoami':admin /usr/local/share sudo chown -R 'whoami':admin /usr/local/local/bin
brew link pkg-configbrew link cmake brew install opencv3 --without-openexr
成功,估计一开始的第一步报的错误,也是没有没有权限建立软件接的问题。
6. 链接到python环境,我这是链接到anaconda建的tensorflow1.0环境下
cd /Users/yuetiezhu/anaconda2/envs/tensorflow1.0/lib/python2.7/site-packagesln -s /usr/local/Cellar/opencv3/3.2.0/lib/python2.7/site-packages/cv2.so cv2.so
/usr/local/Cellar/opencv3/3.2.0/lib/python2.7/site-packages 没有cv.py 只有cv2.so,但是可以用啦
7. 测试一下
source activate tensorflow1.0python import cv2
以上就是MacOS X安装OpenCV3.2说明介绍的详细内容,更多请关注其它相关文章!
推荐阅读
-
基于Linux下Nagios的安装与配置说明介绍[图]
-
Droid4X海马玩模拟器怎么安装本地apk? 海马玩模拟器安装apk的多种方法介绍
-
百度杀毒安装路径在哪里?百度杀毒软件安装包位置说明介绍
-
使用四叶草Clover安装OS X小牛教程图文介绍
-
CentOS 7.x安装MySQL 5.5的详细步骤、基本配置及相关说明
-
macOS安装MySQL的简单使用介绍
-
Droid4X海马玩模拟器怎么安装本地apk? 海马玩模拟器安装apk的多种方法介绍
-
基于Linux下Nagios的安装与配置说明介绍[图]
-
mac os x 安装brew macos xbrew
-
百度杀毒安装路径在哪里?百度杀毒软件安装包位置说明介绍