Answer the question
In order to leave comments, you need to log in
WinError 2: The specified file cannot be found in pytesseract. How to fix?
OCR=Image.open("F:\MEGA\Проекты\PyCharmProjects\SeoClicker\output.gif")
print(image_to_string(OCR))
Traceback (most recent call last):
File "F:/MEGA/Проекты/PyCharmProjects/SeoClicker/test.py", line 64, in <module>
print(image_to_string(OCR))
File "D:\python\lib\site-packages\pytesseract-0.2.0-py3.6.egg\pytesseract\pytesseract.py", line 193, in image_to_string
File "D:\python\lib\site-packages\pytesseract-0.2.0-py3.6.egg\pytesseract\pytesseract.py", line 140, in run_and_get_output
File "D:\python\lib\site-packages\pytesseract-0.2.0-py3.6.egg\pytesseract\pytesseract.py", line 111, in run_tesseract
File "D:\python\lib\subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "D:\python\lib\subprocess.py", line 997, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] Не удается найти указанный файл
import pytesseract
import PIL
''' указываем эти два параметра обязательно! '''
pytesseract.pytesseract.tesseract_cmd = "F:/tess/Tesseract-OCR/tesseract.exe"
tessdata_dir_config = '--tessdata-dir "F:/tess/Tesseract-OCR"'
img = PIL.Image.open("test.png")
# обязательно укажите lang='eng'
text = pytesseract.image_to_string(img, config=tessdata_dir_config, lang="eng")
print(text)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question