Sumant
Sumant

Reputation: 123

Installing OpenCV

I am on Mac OSX El Capitan and am trying to install opencv. I am using homebrew with this command.

Sumant:Sumant$ brew install opencv

The result is Warning: homebrew/science/opencv 2.4.13.2_1 is already installed

Even though it says that opencv is already installed, I can't seem to use it with python. Importing cv2 on python gives the error

>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named cv2

Is opencv different from cv2, if so how do I download cv2 (I already tried to look up questions on stackoverflow but none of those methods work).

Upvotes: 2

Views: 728

Answers (3)

Kamble Tanaji
Kamble Tanaji

Reputation: 497

If you are using anaconda distribution your work will be very easy. Conda installer install most packages seamlessly. For opencv you can try following command after conda installation:

conda install -c menpo opencv3
conda install -c menpo opencv

Upvotes: 0

Sharonsyra
Sharonsyra

Reputation: 1

To install both on your Python 2 and Python 3 use:

brew install opencv3 --with-contrib --with-python3

To install on Python2 only use

brew install opencv3 --with-contrib

To install on Python 3 only use

brew install opencv3 --with-contrib --without-python

There is no --with-python2 flag because by default it installs to python2. However, if you want it to go to Python3 you have to add a --with-python3 flag.

Upvotes: 0

roccolocko
roccolocko

Reputation: 594

There is no real difference. Try the following and you should get going:

pip install opencv-python

Upvotes: 2

Related Questions