ImportError: No module named cv2 on macox - python-2.7

I have used homebrew to install OpenCV, but I cannot use it, when I import OpenCV in Python, I meet this error:
ImportError: No module named cv2; op
system:macos10.12.6
opencv 3.3.0_2
python 2.7.13

Related

Anaconda - Spyder 3.3.6 - Python 2.7 - no module named matplotlib

I'm trying to use matplotlib on spyder 3.3.6 but I'm having trouble importing it in the first place, is there some way to install matplotlib beforehand? I don't have a very specific question, I guess I'm just requesting someone to help me with this. I'm pretty new to using python
import matplotlib.pyplot as plt
and it returns " ImportError: No module named matplotlib.pyplot "
when I run
pip install matplotlib
I get
pip install matplotlib
^
SyntaxError: invalid syntax

ImportError: No module named data_io

l'm under python2.7 l can't import data_io l got this error :
ImportError: No module named data_io
Here is my code
import data_io
reload(data_io)
data = data_io.read_as_df(basename)
Have you run the command?
pip install dataIO
If so are you sure it is install in the right directory? Please provide more details on your pathenv.

OpenCV installation on Anaconda Windows ImportError

I try to install OpenCV but it doesn't work, I get import error:
from conda.cli.main import main
ImportError: No module named conda.cli.main

(Scikit - Python) ImportError: No module named scipy

I'm trying to install Scikit and run a python file that only has:
import sklearn
To check if Scikit works. This is the error I get:
Traceback (most recent call last):
File "hello-world.py", line 1, in
import sklearn
File "/Library/Python/2.7/site-packages/sklearn/init.py", line 57, in
from .base import clone
File "/Library/Python/2.7/site-packages/sklearn/base.py", line 9, in
from scipy import sparse
ImportError: No module named scipy
I have been at this for hours now. My python version is Python 2.7.11
which -a python
gives me this:
/usr/local/bin/python
/usr/bin/python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
/Users/Iliad/anaconda/bin/python
I had had Python 3.5 Installed before, but downloaded Anaconda for 2.7, but can't make sure it is set to work with that version.
Thanks!
I will start with
python --version
Just to be sure
and then in python repl. Use this
import site
site.getsitepackages()
This would give you something like :
['/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']
Check in all the dist-packages for scipy. My guess is that it is not there.
If you have any other "dist-packages" type of folder then you should add that to your PYTHONPATH.

Error in loading OpenCV from Python on OS X Marericks

I've correctly build OpenCV in OS X and I can use it with C++,
however, when I try to load the cv2 module from Python, I get this error:
import cv2
Traceback (most recent call last):
File "", line 1, in
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/cv2.so, 2): Symbol not found: _ZN2cv11FileStorageC1ERKSsiS2
Referenced from: /usr/local/lib/python2.7/site-packages/cv2.so
Expected in: lib/libopencv_core.2.4.dylib
in /usr/local/lib/python2.7/site-packages/cv2.so
I have the same issue both with python and opencv installed from macports and when compiling OpenCV by my self. I have tried to use Python 2.7.5 and 2.7.6 and opencv 2.4.5 and 2.4.6.1