我试图让pytesser (可下载的这里)在我的mac上工作,但我没有成功。
我安装了Tesseract,PIL和所有依赖项。
我在python文件夹中解压缩了pytesser,并在init文件中将脚本文件修改为__init__.py,我按照建议的这里和这里修改了tesseract.exe文件的路径,即:
tesseract_exe_name = 'my lib path/pytesser/tesseract' # Name of executable to be called at command line这就是我所犯的错误:
Traceback (most recent call last):
File "<pyshell#50>", line 1, in <module>
print image_to_string(picz)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pytesser/__init__.py", line 31, in image_to_string
call_tesseract(scratch_image_name, scratch_text_name_root)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pytesser/__init__.py", line 21, in call_tesseract
proc = subprocess.Popen(args)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1228, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error该模块似乎无法运行.exe文件。我试图更改路径,添加扩展.exe,但我总是得到相同的错误。
发布于 2015-09-23 16:28:02
python tesseract包装器的几种解决方案:
Python-Tesseract
首先获得自制和brew安装python,然后是easy_install 64.egg
来源:https://code.google.com/p/python-tesseract/wiki/HowToCompileForHomebrewMac
pytesseract
这是我在获得python( pip install pytesseract )之前使用的。然后你必须去/usr/local/lib/python2.7/site-packages,然后去pytesseract,然后是pytesseract.py。将python脚本中的文件路径更改为tesseract位于计算机上的位置。
https://stackoverflow.com/questions/26084993
复制相似问题