2014-01-10 12 views
6

私はMac Maverickのpytesser(link)のこの例に従おうとしています。私は何をすべきか理解していない、image_to_stringがMacで動作しない

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 

しかし:

>>> from pytesser import * 
>>> im = Image.open('phototest.tif') 
>>> text = image_to_string(im) 

はしかし、最後の行に私は、このエラーメッセージが表示されます。ファイル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 
+0

スクリプトがプロセスを起動する問題を抱えているように見えます...そして、それはhttps://code.google.com/p/pytesser/wiki/で説明したのと同じ問題のように見えますREADME このディストリビューションにはWindows実行ファイルが付属していますが、これはMacでは動作しません。そこに書かれているLinuxの人々は、おそらくtessact実行可能ファイルを提供する必要があります。 – Luis

+0

入手しました。しかし、私はこれをすることはできますか? –

+0

私はそれが可能だと確信していますが、私は詳細を知らない:質問はtessactユーザーのためにタグ付けする必要があります。 – Luis

答えて

8

私は実際に私がこの記事を見つけた方法である、あなたと同じエラーが発生しました。あなたは私にそれを与えたので、私はまた、私の問題の解決策を持っています!

私が見ていた:

ryan.davis$ python tesseract.py 
Traceback (most recent call last): 
    File "tesseract.py", line 52, in <module> 
    print (image_to_string(big)) 
    File "/usr/local/lib/python2.7/site-packages/pytesseract/pytesseract.py", line 161, in image_to_string 
    config=config) 
    File "/usr/local/lib/python2.7/site-packages/pytesseract/pytesseract.py", line 94, in run_tesseract 
    stderr=subprocess.PIPE) 
    File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__ 
    errread, errwrite) 
    File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child 
    raise child_exception 
OSError: [Errno 2] No such file or directory 

は、私はこの問題を解決するためにしなければならなかったかを知りたいですか?正確にあなたが試したもの:brew install tesseract私はtesseractのpythonライブラリをインストールしましたが、それをシステムレベルにインストールしていませんでした。だから私の問題を解決する。あなたはどうですか?

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.

そしてませんが、あなたの答えはすでに醸造応答で提供されていた気づい:

You must brew link libtiff libpng jpeg before tesseract can be installed.

そう:

brew link libtiff 
brew link libpng 
brew link jpeg 

は、私はあなたがこのに気を取られているかもしれないと思います

次に:

012最後に

:) 
+0

ありがとうございます! Mac OS High Sierra、python 3 =) –

関連する問題