I want to use Blender 2.72b with OpenCV, so I had to build it for Python3 (I have 3.4.2 installed since Blender is using that too). I'm working on Win7 64bit, so I used a 64bit version of Python and NumPy (Blender too of course). For OpenCV I used 3.0.0-beta.
For building I used CMake 2.8 and Visual Studio 2010 Professional (since I have a student-license > Visual Studio 10 Win64 in CMake). I followed these instructions (lower ones), modified for python3.
These are my folders: Target build-folder for CMake (OpenCV.sln executed and build in here too of course):
C:\Users\Gunnar\Desktop\build\
OpenCV-source-folder:
C:\Users\Gunnar\Downloads\opencv\sources\
Python installed here:
C:\Python34\
The build went fine, I adjusted the following before generating with CMake (python2 left blank):
PYTHON3_EXECUTABLE -> C:/Python34/python.exe
PYTHON3_INCLUDE_DIR -> C:/Python34/include
PYTHON3_LIBRARY -> C:/Python34/libs/python34.lib
PYTHON3_NUMPY_INCLUDE_DIRS -> C:/Python34/Lib/site-packages/numpy/core/include
PYTHON3_PACKAGES_PATH -> C:/Python34/Lib/site-packages
BUILD_opencv_python3 -> true
The build-folder has a cv2.pyd at
C:\Users\Gunnar\Desktop\build\lib\Release\
The cv2.pyd got copied to
C:\Python34\Lib\site-packages\
automatically and I copied it to
M:\Programme\blender-2.72b-windows64\2.72\python\lib\site-packages\
If I now open the python IDLE, I get the following error (same in Blender of course):
>>> import cv2
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import cv2
ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.
(in english: DLL load failed: Module not found.)
I'm assuming that I'm missing environment variables (from what I've found googling for it).
Looking into them I have no corresponding entry for PATH and no PYTHONPATH.
My problem now is that I don't know what I need to set there. I never really had to change something in there and I don't know what exactly is needed.
If more information are needed let me know.
EDIT: I got i working now. I'm not quite sure, which one it did in the end, but I first used
cmd > setx -m OPENCV_DIR C:\Users\Gunnar\Desktop\build
and than edited the PATH-variable with these:
C:\Users\Gunnar\Desktop\build;
C:\Users\Gunnar\Desktop\build\lib\Release;
C:\Users\Gunnar\Desktop\build\x64\Release;
C:\Users\Gunnar\Desktop\build\bin\Release
And right now it works even though I removed all of them...