First of all, the python code is perfectly working in PyCharm and in command prompt. So, Cv2 module is installed well on my Windows machine.
But when I run by IronPython Script engine, it failed as below.
IronPython.Runtime.Exceptions.ImportException: No module named cv2
I setup IronPython engine as below. Note that site-packages
has cv2.pyd
file.
var engine = Python.CreateEngine();
List<string> pathes = engine.GetSearchPaths().ToList();
pathes.AddRange(new[]
{
@"C:\Python27\Lib\", @"C:\Python27\Lib\site-packages\"
});
engine.SetSearchPaths(pathes);
dynamic py = engine.ExecuteFile("sample.py"); // <- Exception occurred here.
I guess engine.Setup.FileExtensions
has only .py
file, so that cv2.pyd
is not recognized. But, I hardly figure out how to add .pyd
to the setup.
Or, is there anything that I missed?