|

楼主 |
发表于 2024-4-10 15:15:50
|
显示全部楼层
是的,就是这样操作的,可是还是提示
D:\pige>D:/Python37/python.exe d:/pige/ocr.py
Traceback (most recent call last):
File "d:/pige/ocr.py", line 13, in <module>
print(extract_text_from_image("d:\\tmp.jpg"))
File "d:/pige/ocr.py", line 9, in extract_text_from_image
text = pytesseract.image_to_string(image, lang='chi_sim')
File "D:\Python37\lib\site-packages\pytesseract\pytesseract.py", line 427, in image_to_string
}[output_type]()
File "D:\Python37\lib\site-packages\pytesseract\pytesseract.py", line 426, in <lambda>
Output.STRING: lambda: run_and_get_output(*args),
File "D:\Python37\lib\site-packages\pytesseract\pytesseract.py", line 288, in run_and_get_output
run_tesseract(**kwargs)
File "D:\Python37\lib\site-packages\pytesseract\pytesseract.py", line 264, in run_tesseract
raise TesseractError(proc.returncode, get_errors(error_string))
pytesseract.pytesseract.TesseractError: (1, 'Error opening data file C:\\Program Files\\Tesseract-OCR\\tessdata/chi_sim.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory. Failed loading language \'chi_sim\' Tesseract couldn\'t load any languages! Could not initialize tesseract.') |
|