我在Visual Studio 2019(社区)中构建了.pyd
,该库提供了一些仅在LibRaw中提供的功能的包装器。解决方案成功编译,没有任何警告或错误。该项目使用LibRaw,OpenCV和pybind11以及Python.h
和相应的.lib
文件。
[当我尝试在Python解释器中导入.pyd
时,我得到:
C:\Users\Tim.Hilt\source\repos\cr3_converter\Release>dir
Datenträger in Laufwerk C: ist Acer
Volumeseriennummer: EC36-E45E
Verzeichnis von C:\Users\Tim.Hilt\source\repos\cr3_converter\Release
22.01.2020 11:28 <DIR> .
22.01.2020 11:28 <DIR> ..
22.01.2020 11:28 808 cr3_converter.exp
22.01.2020 11:28 3.068.361 cr3_converter.iobj
22.01.2020 11:28 785.552 cr3_converter.ipdb
22.01.2020 11:28 1.908 cr3_converter.lib
22.01.2020 11:28 4.190.208 cr3_converter.pdb
22.01.2020 11:28 953.856 cr3_converter.pyd
31.10.2019 16:22 26.408.085 IMG_0482_raw.CR3
7 Datei(en), 35.408.778 Bytes
2 Verzeichnis(se), 77.160.587.264 Bytes frei
C:\Users\Tim.Hilt\source\repos\cr3_converter\Release>python
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 22:39:24) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cr3_converter
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed while importing cr3_converter: The specified module was not found.
>>> import cr3_converter.pyd
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed while importing cr3_converter: The specified module was not found.
>>>
在系统路径中设置了所需.dlls
的路径(在这种情况下为Python和OpenCV; LibRaw完全静态链接)。
我运行了Dependency-Walker,但找不到任何可疑的东西。 Here is the corresponding Dependency Walker image。我还尝试了另一种工具(Dependencies.exe,本质上是对Dependency Walker的重写,但考虑了API-MS-WIN-CORE-....dlls
)并出现错误,看起来像这样:
当我将鼠标悬停在缺少的.dll
上时,我可以看到api-ms-win... module could not be found on disk
。我搜索并找到了模块,并将其目录路径添加到系统路径。现在,该模块不再以红色突出显示,但是C:\WINDOWS\SysWOW64\WS2_32.dll
(屏幕截图顶部的红色突出显示)仍然显示缺少导入。这可能是个问题吗?
我如何制作.pyd
:
.dll
-配置和.pyd
-文件扩展名.pyd
我见过this question,其中OP的问题是库加载了不同的Python- .dlls
,但就我而言,Dependency Walker引用的库与我在路径中所引用的库相同-变量。
我在Visual Studio 2019(Community)中构建了一个.pyd,它为LibRaw中仅提供的某些功能提供了包装。解决方案成功编译,没有任何警告或错误。 ...
我悄悄地假定Windows在与系统(/用户).dll
变量中列出的目录相同的目录中搜索PATH
。