【问题标题】:python having issue to load dllpython在加载dll时遇到问题
【发布时间】:2021-08-04 23:37:03
【问题描述】:

我已确认:MSFTTCJTAG.dll 存在于 C:\ddey_documents 中。加载时遇到问题。有什么帮助吗?

import os
from ctypes import *
os.chdir(r'c:\ddey_documents')
Flywatter2 = WinDLL(r"C:\ddey_documents\MSFTFTCJTAG.dll")

错误:

File "C:\Python39\lib\ctypes\__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'C:\ddey_documents\MSFTFTCJTAG.dll' (or one of its dependencies). Try using the full path with constructor syntax.

我尝试过的事情:

  1. 尝试在没有帮助的情况下添加以下内容: os.add_dll_directory(r"C:\ddey_documents)

  2. 最初出现以下错误,OSError: [WinError 193] %1 is not a valid Win32 application. 它通过应用以下两个步骤得到修复:

【问题讨论】:

标签: python dll ctypes


【解决方案1】:

我现在可以使用 dumpbin 检查 DLL 的所有依赖项:

  1. 安装 Visual Studio(我做了社区版)
  2. 打开 --> 工具 --> 命令行 --> 开发者命令提示符
  3. 输入dumpbin
  4. 如果它显示can't find dumpbin。您需要转到 --> 安装 Visual Studio 的文件夹 --> 2019 --> Community\VC\Tools\MSVC\14.29.30037\bin\Hostx64\x64 并安装 editbin.exe
  5. 运行您的 dll:dumpbin /DEPENDENTS MSFTFTCJTAG.dll

结果:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-05-07
    • 1970-01-01
    • 2021-11-08
    • 1970-01-01
    • 1970-01-01
    • 2011-12-12
    • 2018-04-09
    相关资源
    最近更新 更多