python - Pycharm will not recognize opencv3 -


so guys after painful day have gotten opencv recognized in python 3 :

python 3.5.1 (v3.5.1:37a07cee5969, dec  5 2015, 21:12:44)  [gcc 4.2.1 (apple inc. build 5666) (dot 3)] on darwin type "help", "copyright", "credits" or "license" more information. >>> import cv2 >>> cv2.__version__ '3.1.0' 

but when in pycharm result is:

    /library/frameworks/python.framework/versions/3.5/bin/python3.5 "/users/saminahbab/documents/directory/image recognition /pictures/searcher.py" traceback (most recent call last):   file "/users/saminahbab/documents/directory/image recognition /pictures/searcher.py", line 3, in <module>     import cv2 importerror: no module named 'cv2' 

which number of reasons, have tried sorts of symlinks within reason, trying pyenv among others know these different python builds wouldnt know unify them cv2 working on pycharm , keep of other packages using in conjunction. advice?

an easy way pycharm working opencv 3 follows:

  1. install anaconda directory doesn't require admin access https://www.continuum.io/downloads
  2. create virtual environment (optional):

    conda create -n <yourenvname> python=<yourpython3version> anaconda

    source activate <yourenvname> (source not required if using anaconda prompt in windows)

  3. install opencv 3: conda install -n <yourenvname> -c https://conda.anaconda.org/menpo opencv3

  4. setup pycharm: open pycharm --> file --> settings --> project --> project interpreter --> click on config wheel, select "add local". add <youranacondadir>\envs\<yourenvname>\python.exe , wait till pycharm done indexing

finally, create new python file , check if opencv 3 has been setup typing:

import cv2 print(cv2.__version__) 

Comments