自作で Tesseract をインストールしましたが、コマンド ラインでは問題なく動作します。例:
tesseract "image.jpg" output.txt
しかし、texttract や pytesseract のような python tesseract ラッパーと組み合わせて使用しようとすると、次のエラーが発生します。
textract.exceptions.ShellError: The command `tesseract "captcha.jpg"
/var/folders/1k/30brhf2n2y7ct_z7rhgtm9qr0000gn/T/tmpcFy9Sk >
/dev/null && cat /var/folders/1k/30brhf2n2y7ct_z7rhgtm9qr0000gn/T/tmpcFy9Sk.txt &&
rm -f /var/folders/1k/30brhf2n2y7ct_z7rhgtm9qr0000gn/T/tmpcFy9Sk /var/folders/1k/30brhf2n2y7ct_z7rhgtm9qr0000gn/T/tmpcFy9Sk.txt`
failed because the executable
`tesseract` is not installed on your system. Please make
sure the appropriate dependencies are installed before using textract
私が試したとき:
from subprocess import call
call(["tesseract", "image.jpg", "output.txt"])
エラーが発生します:
OSError: [Errno 2] No such file or directory
brew info tesseract は以下を返します:
tesseract: stable 3.04.01 (bottled), HEAD
OCR (Optical Character Recognition) engine
https://github.com/tesseract-ocr/
/usr/local/Cellar/tesseract/3.04.01_1 (76 files, 38.8M) *
Poured from bottle
From: https://github.com/Homebrew/homebrew- core/blob/master/Formula/tesseract.rb
==> Dependencies
Required: leptonica ✔
Recommended: libtiff ✔