首页 文章

缺少或不兼容的文件:ImportError:DLL加载失败:%1不是有效的Win32应用程序

提问于
浏览
4

问题:

尝试将python-tesseract导入我的项目时出现此错误(OCR功能):

ImportError: DLL load failed: %1 is not a valid Win32 application.

  • 我不知道究竟是什么问题

  • 我没有技能和知识来追踪这类问题的根本原因 .

背景:

据我了解,tesseract是一个32位应用程序 . 我正在使用64位python运行Windows 7,64位 . 其他人似乎在这些条件下运行tesseract,但他们并不理想,可能会导致这一挑战 .

堆栈跟踪

这是来自PyCharm的错误跟踪 . 正如您所看到的,它没有指定问题的文件,而是说它无法找到看起来像字符串格式的参数: %1

Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm 2.7.3\helpers\pydev\pydevd.py", line 1481, in 
    debugger.run(setup['file'], None, None)
  File "C:\Program Files (x86)\JetBrains\PyCharm 2.7.3\helpers\pydev\pydevd.py", line 1124, in run
    pydev_imports.execfile(file, globals, locals) #execute the script
  File "C:/Dropbox/COC/automate/coc_automate/python/__init__.py", line 7, in 
    import tesseract
  File "C:\Python27\lib\site-packages\tesseract.py", line 28, in 
    _tesseract = swig_import_helper()
  File "C:\Python27\lib\site-packages\tesseract.py", line 22, in swig_import_helper
    _mod = imp.load_module('_tesseract', fp, pathname, description)
ImportError: DLL load failed: %1 is not a valid Win32 application.

Dependency Walker

Ran依赖沃克对文件似乎是个问题: _tesseract.pyd 并发现了一些看起来很奇怪的东西:

  • 找不到Python27.dll

  • 尽管我已经成功使用Python很长一段时间了 .

  • 我确认 Python.dll 位于我系统的 C:\Windows\System32

  • 文件 MSVCR90.DLL 是错误的CPU版本 .

  • 在"expected"之类的"expected"区域中找不到它,而是在我安装的小众图形库的程序文件目录中找到: c:\program files\graphicsmagick-1.3.18-q8\MSVCR90.DLL . 这两个装置是否存在相互混淆的问题?

PYTHON27.DLL Error opening file.            The system cannot find the file specified (2).
API-MS-WIN-CORE-COM-L1-1-0.DLL              The system cannot find the file specified (2).   
API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL      The system cannot find the file specified (2).
API-MS-WIN-CORE-WINRT-L1-1-0.DLL            The system cannot find the file specified (2).
API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL   The system cannot find the file specified (2).
API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL     The system cannot find the file specified (2).
API-MS-WIN-SHCORE-SCALING-L1-1-0.DLL        The system cannot find the file specified (2).
DCOMP.DLL                                   The system cannot find the file specified (2).
GPSVC.DLL                                   The system cannot find the file specified (2).
IESHIMS.DLL                                 The system cannot find the file specified (2).
...
c:\program files\graphicsmagick-1.3.18-q8\MSVCR90.DLL (Seems to be the wrong CPU version)


Error: At least one required implicit or forwarded dependency was not found.
Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
Error: Modules with different CPU types were found.
Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.

Screen shot:

enter image description here

1 回答

  • 2

    MSVCR90.DLL作为Visual C 2008运行时的一部分提供 . 您似乎需要在此处下载并安装运行时:http://www.microsoft.com/en-us/download/details.aspx?id=15336

    作为旁注,在python-tesseract页面上它说:

    VS2008编译的Windows版现已上市!

    似乎有人选择编译应用程序以要求使用运行时msvc 2008运行时而不是静态链接运行时库 . 您可能想要让它们更改它,因为使用该python模块将在您要运行python脚本的任何工作站上添加该额外需求 .

相关问题