我試圖在Mac Maverick中遵循pytesser(link)的這個例子。image_to_string在Mac無法正常工作
>>> 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在我運行腳本的同一個文件夾中。如何解決這個問題?
UPDATE:
當我嘗試
brew install tesseract
我得到這個錯誤:
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
它看起來像你的腳本有一個啓動過程中的問題......它看起來像https://code.google.com/p/pytesser/wiki/描述了同樣的問題自述文件 發行版隨附Windows可執行文件,在Mac上無法使用。正如那裏提到的Linux人員,您可能需要提供一個tessact可執行文件。 – Luis
明白了。但我可以這樣做嗎? –
我確定它是可行的,但我不知道詳細信息:應爲tessact用戶標記問題。 – Luis