I created a new environment in anaconda for python 3.5 and installed all the required pip libraries including opencv.
If I execute the following in command line
$ python
Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:52:12)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>>
As you can see above there is no issues importing cv2.
However when I open Jupyter notebook and execute the following
#importing some useful packages
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import cv2
%matplotlib inline
I get the following error
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-5-69f36577ffd4> in <module>()
3 import matplotlib.image as mpimg
4 import numpy as np
----> 5 import cv2
6 get_ipython().magic('matplotlib inline')
ImportError: No module named 'cv2'
I also tried cycling through all the available kernals in Kernal->Change Kernal
settings. That didnt help either
The following comment by @Destrif fixed it
import sys
sys.path.append('/Users/[username]/Applications/anaconda/envs/UdacityNanoCar/lib/python3.5/site-packages')
If there is more elegant answer I welcome it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With