Ariel
Ariel

Reputation: 988

Python Import cv2 error in jupyter works on mac terminal

I am having difficulty importing cv2 on jupyter notebook. However, when I enter:

import cv2 

in the mac terminal there is no error.

I referenced post 1 to identify that jupyter notebook refers to python3.5 file path where as mac terminal where the import works fine refers to python 2.7 file path.

I entered the below in jupyter notebook as referenced in post 2 to solve the issue, but I'm still getting an error:

import sys
sys.path.append('/usr/local/lib/python2.7/site-packages')
import cv2

enter image description here

Any help greatly appreciated!

Upvotes: 0

Views: 242

Answers (1)

Maarten Fabré
Maarten Fabré

Reputation: 7058

I don't think you can use a module for python 2.7 in python 3.5, so you'll either have to install cv2 in your python3 environment or get jupyter to use python2

Upvotes: 1

Related Questions