python - import error OpenCV on Jupyter Notebook (but it works in Ipython on Terminal..) -
i'm having interesting error import cv2
in ipython on terminal cannnot import library on jupyter notebook. checked kernel i'm using same kernel (anaconda python2.7)
would has idea how fix this?
error: importerrortraceback (most recent call last) <ipython-input-2-52da0154cfe4> in <module>() ----> 1 import cv2 2 import numpy np importerror: no module named cv2
$import os
$os.sys.path
['', '/users/kn/anaconda2/envs/python2/lib/python27.zip', '/users/kn/anaconda2/envs/python2/lib/python2.7', '/users/kn/anaconda2/envs/python2/lib/python2.7/plat-darwin', '/users/kn/anaconda2/envs/python2/lib/python2.7/plat-mac', '/users/kn/anaconda2/envs/python2/lib/python2.7/plat-mac/lib-scriptpackages', '/users/kn/anaconda2/envs/python2/lib/python2.7/lib-tk', '/users/kn/anaconda2/envs/python2/lib/python2.7/lib-old', '/users/kn/anaconda2/envs/python2/lib/python2.7/lib-dynload', '/users/kn/anaconda2/envs/python2/lib/python2.7/site-packages', '/users/kn/anaconda2/envs/python2/lib/python2.7/site-packages/sphinx-1.4.6-py2.7.egg', '/users/kn/anaconda2/envs/python2/lib/python2.7/site-packages/aeosa', '/users/kn/anaconda2/envs/python2/lib/python2.7/site-packages/setuptools-27.2.0-py2.7.egg', '/users/kn/anaconda2/envs/python2/lib/python2.7/site-packages/ipython/extensions', '/users/kn/.ipython']
$which python
/users/kn/anaconda2/envs/python2/bin/python
create one-line opencv.pth
file under /users/kn/anaconda2/lib/python2.7/site-packages
.
the content of file like:
/usr/local/opt/opencv3/lib/python2.7/site-packages
this append opencv3
path under conda environments permanently. think it's better make cv2 available python2
environment.
Comments
Post a Comment