image_to_string doesn't work in Mac

拜拜、爱过 提交于 2019-12-05 06:22:44

I actually had the same error as you, which is how I found this post. I also have the solution to my problem, because you gave it to me!

I was seeing:

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

Want to know what I had to do to fix this? Exactly what you tried: brew install tesseract I had installed the tesseract python library, but hadn't installed it at the system level. So that solves my problem. How about yours?

I think you might have been distracted by this:

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.

And not noticed your answer was already provided in the brew response:

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

So do:

brew link libtiff 
brew link libpng 
brew link jpeg

Then:

brew install tesseract

Finally:

:)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!