我已经在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的初学者。