Reputation: 461
I am currently working on a project that add a new module to OpenCV 3.0 beta so I am trying to use my own compiled version with Python (just as a remark, the C++ version works).
Since I don't want to mess up with versions of OpenCV and Python already installed, I did not add to ldconfig my specific build/installation of OpenCV 3.0 beta and I would like to use it in a python virtualenv if possible.
So far I have setup the venv and since cv2 is not accessible in it, I update the PYTHONPATH
to add the folder containing the cv2.so
file (created with sudo apt-get install python-opencv
). However, it is not the right version of opencv binding that are loaded :
$ python -c "import cv2; print cv2.__version__"
2.4.8
Have any idea on what I could do ?
EDIT (thanks @otibom):
My build seems to be the reason why I don't have the right cv2.so
file. The results of cmake are :
-- 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
Is there a way to correct that ?
Upvotes: 3
Views: 4479
Reputation: 461
Regarding the "libraries not found" problem, I removed the file CMakeCache.txt
and at the following cmake command it found python libraries. (but I have no idea why that happened)
Upvotes: 1
Reputation: 4028
Compiling OpenCV 3.0 will create its own cv2.so
file containing your new module, typically in your opencv3-0-0-beta/build
directory. You need to add the OpenCV 3.0 build directory to PYTHONPATH
instead of the one created by apt-get.
Upvotes: 0