I know that this question has already been asked here a few times, but since no answer helped me so far, I'm posting it here again.
What I did:
I cloned the repository https://github.com/Itseez/opencv, created and changed to the build directory and compiled OpenCV using the following commands.
cmake -D CMAKE_BUILD_TYPE=RELEASE -D WITH_TBB=ON -D BUILD_opencv_python2=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D WITH_VTK=ON -D WITH_CUDA=ON -D WITH_CUBLAS=ON -D CUDA_ARCH_BIN="2.0 3.0 3.5" ..
make
sudo make install
Everything compiled fine. Afterwards I added /usr/local/lib
to /etc/ld.so.conf.d/opencv.conf
and performed sudo ldconfig
. Finally, I added
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
to my local bashrc. Everything worked fine and I also can execute the cpp examples, but as soon as I try a python example or try using OpenCV in python myself, I get:
ImportError: No module named cv2
Things I tried based on other posts:
Manually copy
cv2.so
to/usr/local/lib/python2.7/dist-packages
: Did not work because I cannot find cv2.so anywhere.Missing numpy or multiple versions of numpy: No problem here, because I only have one version of numpy.
Additional:
I also tried the same steps with the most recent sources from the homepage: same result.
I found several ressources saying that the correct flag is BUILD_NEW_PYTHON_SUPPORT
now and not BUILD_PYTHON_SUPPORT
, like it was in earlier version. Since both didn't work for me, I used BUILD_opencv_python2
. Is that correct?
So, what could be the problem here? I mean, except the fact that there is no cv2.so anywhere on my machine. Btw, I use Ubuntu 14.04.
Thanks in advance.