文件'tesseract.log'缺少(Python 2.7,Windows)

我试图用Python(2.7,Windows OS)编写OCR脚本来从图像中获取文本。 首先,我已经下载了PyTesser并将其作为“pytesser”提取到Python27 / Lib / site-packages,并且已经使用pip install tesseract 。 然后,我将下面的脚本编写为self.py:

from PIL import Image
from pytesser.pytesser import *

image_file = 'C:/Users/blabla/test.png'
im = Image.open(image_file)
text = image_to_string(im)
text = image_file_to_string(image_file)
text = image_file_to_string(image_file, graceful_errors=True)
print text

但我收到以下错误:

Traceback (most recent call last):
  File "C:/Users/blabla/self.py", line 7, in <module>
    text = image_file_to_string(image_file)
  File "C:Python27libsite-packagespytesserpytesser.py", line 44, in image_file_to_string
    call_tesseract(filename, scratch_text_name_root)
  File "C:Python27libsite-packagespytesserpytesser.py", line 24, in call_tesseract
    errors.check_for_errors()
  File "C:Python27libsite-packagespytessererrors.py", line 10, in check_for_errors
    inf = file(logfile)
IOError: [Errno 2] No such file or directory: 'tesseract.log'

是的,任何地方都没有'tesseract.log'文件。 我该怎么办? 我应该如何解决这个问题?

先谢谢你。

注:我已经改了行tesseract_exe_name从pytesser.py从正方体C:/ Python27 /库/站点包/ pytesser /正方体 ,但它不工作。

编辑:好吧,我刚刚运行了'pytesser'中的teseract.exe,它创建了'tesseract.log'文件,但我仍然收到相同的错误。


我已将def check_for_errors(logfile = "tesseract.log"):的行更改为def check_for_errors(logfile = "C:/Python27/Lib/site-packages/pytesser/tesseract.log"): in ../pytesser /errors.py ,它的工作。

链接地址: http://www.djcxy.com/p/96741.html

上一篇: File 'tesseract.log' is Missing (Python 2.7, Windows)

下一篇: How can I hide the console window when I run tesseract with pytesser