Reputation: 2356
I have looked for a proper way to install OpenCV, but all I can find are people fudging around with Python 2.old or virtualenv or other things that are utterly irrelevant. I just want be able to run import cv2
without any import errors.
How do I install OpenCV on OS X 10.11 for use with Python 3.5.1?
Upvotes: 2
Views: 4225
Reputation: 426
For me the only working way was using conda:
conda install --channel https://conda.anaconda.org/menpo opencv3
and then import it using import cv2
Upvotes: 3
Reputation: 8008
We can install opencv3 for Python3(Python3.5) for Mac OS X with homebrew.
First, install homebrew:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
You can see the details for how to install homebrew. http://brew.sh
If you don't install Python3, install python3:
brew install python3
Then install opencv3 for python3:
brew install opencv3 --with-python3
Finally, maybe you will link site-packages of opencv3 to the site-packages of Python3:
In the follow command, /usr/local/opt/opencv3/lib/python3.5/site-packages
is the directory of opencv3's site-packages, /usr/local/lib/python3.5/site-packages/
is the directory of Python3.5's site-packages. Maybe you should change the two to your own directories.
echo /usr/local/opt/opencv3/lib/python3.5/site-packages >> /usr/local/lib/python3.5/site-packages/opencv3.pth
Upvotes: 2
Reputation: 1523
For mac, i would suggest using homebrew
(http://brew.sh), the best package manager for osx; after you install it, you can simply use -from a terminal-:
brew search xxx
To search for a package 'xxx'; in this case, try brew search opencv
and you will get the results opencv
and opencv3
, then just install opencv3
with:
brew install opencv3
And that's it, it will install all the required dependencies (which are listed if you use brew info opencv3
).
Any question, just ask.
Upvotes: 0