[英]failed to load dll with opencv in python
I am trying to build a c++ dll using visual studio and load this dll in python.我正在尝试使用 Visual Studio 构建一个 c++ dll 并在 python 中加载这个 dll。 The dll code
dll代码
#define DLLEXPORT extern "C" __declspec(dllexport)
#include "test.h"
#include "opencv2\\highgui.hpp"
using namespace cv;
DLLEXPORT int sumV() {
Mat a = Mat::zeros(5,5, CV_8U);
return 11;
}
and python code is和python代码是
from ctypes import *
from ctypes.util import *
dll = find_library('C:\\path\\dll1.dll')
lib = cdll.LoadLibrary(dll)
I always got "OSError: [WinError 126] The specified module could not be found."我总是收到“OSError: [WinError 126] 找不到指定的模块”。 when I run the python code.
当我运行 python 代码时。
Does anyone know how to solve this problem?有谁知道如何解决这个问题? thanks a lot.
多谢。
Here is how I fixed the problem.这是我解决问题的方法。 In my c++ code, I called opencv function, but I forget copying the opencv dll to my python script folder.
在我的 C++ 代码中,我调用了 opencv 函数,但我忘记将 opencv dll 复制到我的 python 脚本文件夹中。 So python can't find it.
所以python找不到它。 Thanks Yunus again for the help.
再次感谢尤努斯的帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.