python - Fails to build OpenCV 3 with Python2 support -


i tried build opencv 3 python support (with cuda, too) ubuntu 14.04 using cmake-gui.

the compilation seems work fine until python console:

>>> import cv2 traceback (most recent call last):   file "<stdin>", line 1, in <module> importerror: no module named cv2 

i tried both python3 enabled or disabled without change. cmakecache.txt is here.

any idea fix problem?

i had same problem since yesterday, , solved follows:

  1. download opencv 3(beta, rc1) , install necessary dependencies, including python dev package.
  2. open cmake gui.
  3. activate grouped checkbox.
  4. select opencv source , build directories (or delete cache if configured).
  5. press configure. select preferred generator.
  6. check/uncheck options need (opengl support, tbb, etc.)
    • if want, can press configure after every option modification see if fails or not. ignore python2 options now.
  7. once have configured other options, select python2 group , delete remove entry.
  8. press configure. python2 group reappear, in red. not change more, press generate.

now can make/compile usual way. cv2.so file created in build/lib/ directory. make install installed python 2.

if still not work maybe problem somewhere else. after step 8, cmake output must include lines (actual paths might different in case):

python 2:     interpreter:                 /usr/bin/python2.7 (ver 2.7.6)     libraries:                   /usr/lib/i386-linux-gnu/libpython2.7.so (ver 2.7.6)     numpy:                       /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.8.2)     packages path:               lib/python2.7/dist-packages 

in no case there can line saying no, like:

python 2:     interpreter:                 /usr/bin/python2.7 (ver 2.7.6)     libraries:                   no     numpy:                       /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.8.2)     packages path:               lib/python2.7/dist-packages 

hope helps.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -