2

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).

2
  • Have you tried to install OpenCV with pip? Commented Aug 15, 2017 at 17:01
  • Yes, open cv does not install with pip. It has to be built Commented Aug 16, 2017 at 0:57

3 Answers 3

2

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

pip install opencv-python
Sign up to request clarification or add additional context in comments.

Comments

0

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.

1 Comment

Getting this Error: invalid option: --with-contrib
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.