I'm trying to follow this example of pytesser (link) in a Mac Maverick.
我正在尝试遵循一个Mac Maverick的pytesser(链接)的例子。
>>> from pytesser import *
>>> im = Image.open('phototest.tif')
>>> text = image_to_string(im)
But, in the last line I get this error message:
但是,在最后一行,我得到了这个错误信息:
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
But, I don't understand what I should do. The file phototest is in the same folder I'm running the script. How to fix this?
但是,我不明白我该怎么做。文件phototest在我运行脚本的同一个文件夹中。如何解决这个问题?
UPDATE:
更新:
When I try
当我尝试
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
1 个解决方案
#1
8
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?
想知道我需要做些什么来解决这个问题吗?确切地说,您所尝试的是:brew安装tesseract我已经安装了tesseract python库,但是没有在系统级别安装它。这就解决了我的问题。你的怎么样?
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.
警告:似乎已经安装了MacPorts或Fink。与其他包管理器一起安装的软件会给自酿带来已知的问题。如果一个公式没有建立,卸载MacPorts/Fink并再次尝试。
And not noticed your answer was already provided in the brew response:
没有注意到你的答案已经在brew响应中提供了:
You must brew link libtiff libpng jpeg before tesseract can be installed.
在可以安装tesseract之前,您必须准备好链接libpng jpeg。
So do:
所以做的事:
brew link libtiff
brew link libpng
brew link jpeg
Then:
然后:
brew install tesseract
Finally:
最后:
:)
#1
8
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?
想知道我需要做些什么来解决这个问题吗?确切地说,您所尝试的是:brew安装tesseract我已经安装了tesseract python库,但是没有在系统级别安装它。这就解决了我的问题。你的怎么样?
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.
警告:似乎已经安装了MacPorts或Fink。与其他包管理器一起安装的软件会给自酿带来已知的问题。如果一个公式没有建立,卸载MacPorts/Fink并再次尝试。
And not noticed your answer was already provided in the brew response:
没有注意到你的答案已经在brew响应中提供了:
You must brew link libtiff libpng jpeg before tesseract can be installed.
在可以安装tesseract之前,您必须准备好链接libpng jpeg。
So do:
所以做的事:
brew link libtiff
brew link libpng
brew link jpeg
Then:
然后:
brew install tesseract
Finally:
最后:
:)