gpt4 book ai didi

python - Windows 错误 : [Error 126] The specified module could not be found

转载 作者:IT老高 更新时间:2023-10-28 22:18:44 25 4
gpt4 key购买 nike

我正在使用以下代码在 python 中加载一个 dll:

if os.path.exists(dll_path):
my_dll = ctypes.cdll.LoadLibrary(dll_path)

但我不断收到以下错误

WindowsError: [错误 126] 找不到指定的模块

dll 存在于指定路径,但我不明白为什么会出现错误。

最佳答案

请注意,即使 DLL 在您的路径中。如果该 DLL 依赖于不在您的路径中的其他 DLL,您可能会遇到相同的错误。在这种情况下,Windows 找不到依赖项。 Windows 并不擅长告诉你它找不到什么,只是告诉你它没有找到什么。这取决于你。 Windows dll 搜索路径可以在这里找到: http://msdn.microsoft.com/en-us/library/7d83bc18.aspx

在我的例子中,确保所有需要的 dll 都在同一个目录中并对那个目录执行 os.chdir() 解决了这个问题。

关于python - Windows 错误 : [Error 126] The specified module could not be found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1940578/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com