Instructions for installing OpenCV3.2 on MacOS X

高洛峰
Release: 2017-03-16 09:38:56
Original
1821 people have browsed it

windows platform and linuxplatformInstallationSee the official documentation: http://docs.opencv.org/3.2.0/da/df6/tutorial_py_table_of_contents_setup.html

The official platform cannot be found when installed under mac. Reference:

https://www.learnopencv.com/install-opencv-3-on-yosemite-osx-10-10-x/

Core instructions Just two sentences, super simple.

brew tap homebrew/science
brew install opencv3
Copy after login


#But we also encountered a bunch of problems. The recording process is as follows:

1.

brew install opencv3
Copy after login


Error report:

Error: You must `brew link openexr` before homebrew/science/opencv3 can be installed
Copy after login


2. I thought there was no To install openexr, I checked http://www.openexr.com/ and I think it’s okay not to install it. There happens to be the --without-openexr option, so:

brew install opencv3 --without-openexr
Copy after login


Error report:

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

………………
Copy after login


##3. Then follow the prompts:

brew link pkg-config
Copy after login
Error report:


Error: Could not symlink share/aclocal/pkg.m4/usr/local/share/aclocal is not writable.
Copy after login
4. Oh, no permissions. Then:


sudo brew link pkg-config
Copy after login
Error:


Error: Running Homebrew as root is extremely dangerous and no longer supported.
Copy after login
5. It turns out that it is not allowed, so I have to change the folder permissions


whoami# 下面两个命令中的‘whoami’用刚才命令的输出代替sudo chown -R 'whoami':admin /usr/local/share         
sudo chown -R 'whoami':admin /usr/local/local/bin
Copy after login

brew link pkg-configbrew link cmake
brew install opencv3 --without-openexr
Copy after login
is successful. It is estimated that the error reported in the first step is also a problem of not having permission to create a software connection.


6. Link to the

python environment. I am linking to the tensorflow1.0 environment built by anaconda

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
Copy after login
/usr/local/Cellar/opencv3 /3.2.0/lib/python2.7/site-packages There is no cv.py, only cv2.so, but it can be used


7. Test it

source activate tensorflow1.0python
import cv2
Copy after login



The above is the detailed content of Instructions for installing OpenCV3.2 on MacOS X. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template