Всем привет, использую Pyteseract что бы прочитать текст с картинки (текст на русском), но выдает ошибку:
Traceback (most recent call last):
File "C:\Users\HP\PycharmProjects\pythonProject\.idea\Bots\Perevodchik.py", line 31, in <module>
text = pytesseract.image_to_string(img, lang= 'rus')
File "C:\Users\HP\AppData\Roaming\Python\Python39\site-packages\pytesseract\pytesseract.py", line 409, in image_to_string
return {
File "C:\Users\HP\AppData\Roaming\Python\Python39\site-packages\pytesseract\pytesseract.py", line 412, in <lambda>
Output.STRING: lambda: run_and_get_output(*args),
File "C:\Users\HP\AppData\Roaming\Python\Python39\site-packages\pytesseract\pytesseract.py", line 287, in run_and_get_output
run_tesseract(**kwargs)
File "C:\Users\HP\AppData\Roaming\Python\Python39\site-packages\pytesseract\pytesseract.py", line 263, in run_tesseract
raise TesseractError(proc.returncode, get_errors(error_string))
pytesseract.pytesseract.TesseractError: (1, 'Error opening data file C:\\Program Files (x86)\\Tesseract-OCR\\rus.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory. Failed loading language \'rus\' Tesseract couldn\'t load any languages! Could not initialize tesseract.')
Ps: Все языки установлены, я хз что делать. Помогите пж!
Кусок кода:
import pytesseract
filename = 'Image.png'
pytesseract.pytesseract.tesseract_cmd = "C:\Program Files (x86)\Tesseract-OCR/tesseract.exe"
img = Image.open(filename)
text = pytesseract.image_to_string(img, lang= 'rus')