我正在使用pybind11在C++中开发python库。问题是python 3.7/3.6运行良好,但python 3.8无法导入。这是导入库时的错误(假设库名为mylibrary)。
ImportError: DLL load failed while importing mylibrary: The specified module could not be found.为什么Python3.8可以在pybind11中构建,但不能导入?
发布于 2020-07-14 17:10:22
您的C++ python库本身可能依赖于一个共享库/ DLL。Python 3.7/3.6会在PATH或当前工作目录中搜索DLL,但在Python 3.8中不再是这样:
https://docs.python.org/3.8/whatsnew/3.8.html#ctypes
如果这就是问题所在,您可以添加use add_dll_directory()来告诉Python3.8应该在哪里查找DLL。
https://stackoverflow.com/questions/62695107
复制相似问题