尝试将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.
将依赖性walker放在似乎是问题的文件上:_tesseract.pyd
并发现一些看似奇怪的事情:
Python.dll
位于我系统上的C:\Windows\System32
MSVCR90.DLL
是错误的CPU版本。
C:\Windows\System32
等“预期”区域中找不到它,而是在我安装的小众图形库的程序文件目录中找到它: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.
截图:
答案 0 :(得分: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脚本的任何工作站上添加额外的要求。