Python:无法加载语言'eng \'Tesseract无法加载任何语言

时间:2018-11-16 15:14:38

标签: python-3.x opencv computer-vision tesseract python-tesseract

我已经在Windows 10上安装了Tesseract 3.05。 我正在尝试对给定图像执行image_to_string()操作。

该函数无法找到tessdata文件夹。 我什至在环境变量下添加了TESSDATA_PREFIX,其路径指向tessdata中存在的C:\Program Files (x86)\Tesseract-OCR\tessdata文件夹。

tessdata包含eng.traineddata,但仍然无法读取。

错误如下:

File "ocr.py", line 38, in <module>
  text = pytesseract.image_to_string(Image.open(filename))
File "C:\Users\skuma\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pytesseract\pytesseract.py", line 294, in image_to_string
  return run_and_get_output(*args)
File "C:\Users\skuma\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pytesseract\pytesseract.py", line 202, in run_and_get_output
  run_tesseract(**kwargs)
File "C:\Users\skuma\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pytesseract\pytesseract.py", line 178, in run_tesseract
  raise TesseractError(status_code, get_errors(error_string))
pytesseract.pytesseract.TesseractError: (1, 'Error opening data file \\Program Files (x86)\\Tesseract-OCR\\tessdata/eng.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to the parent directory of your "tessdata" directory. Failed loading language \'eng\' Tesseract couldn\'t load any languages! Could not initialize tesseract.')

这里是反斜杠(Windows 10默认)和正斜杠(Linux风格)混合使用的问题 或者是别的什么?有人可以帮我吗?我仍然是Tesseract的初学者。

0 个答案:

没有答案