我正在尝试在Mac Maverick上跟随pytesser的这个示例(链接)。
>>> from pytesser import *
>>> im = Image.open('phototest.tif')
>>> text = image_to_string(im)
但是,在最后一行我遇到了这个错误信息:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pytesser.py", line 31, in image_to_string
call_tesseract(scratch_image_name, scratch_text_name_root)
File "pytesser.py", line 21, in call_tesseract
proc = subprocess.Popen(args)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1308, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
但是,我不明白我应该做什么。文件 phototest 在我运行脚本的同一文件夹中。如何解决这个问题?
更新:
当我尝试时:
brew install tesseract
I get this error:
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
Error: You must `brew link libtiff libpng jpeg' before tesseract can be installed
brew install tesseract
命令安装 Tesseract。 - Andrea de Marco