Question

I'm trying to execute a python script that uses the Python-binding of OpenCV library, but when I click 'Run Script' in blender I have gotten the following error in the console:

ImportError: No module named 'cv2'
Error: Python script fail, look in the console for now...

Firstly I have copied-pasted the file cv2.pyd from: C:\opencv\build\python\2.7 to: C:\Program Files\Blender Foundation\Blender\2.66\python\lib and the new error is:

ImportError: Module use of python27.dll conflicts with this version of Python.have
Error: Python script fail, look in the console for now...

Then I have copied-pasted the file with same name but from C:\opencv\build\python\2.6 and the new output:

ImportError: DLL load failed: Le module spécifié est introuvable.
Error: Python script fail, look in the console for now...

My Config:

Win7 32bit
OpenCV 2.4.6
Both Python 3.3 and 2.7 
Blender 2.66

Qt: How can I make Blender & OpenCV friends?

Was it helpful?

Solution

You have the idea right but you will need the opencv module to be built against python 3.3 not python 2.7 version that you have tried.

blender has used python 3.x since 2.50 with 2.65 and higher using python 3.3

When configuring to build the python module for opencv you will want to look to enable python 3 or 3.3 support maybe referred to as py3k, maybe just pointing it to your python 3.3 installation instead of 2.7

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top