AttributeError: частично инициализированный модуль pytesseract не имеет атрибута image_to_string - PullRequest
0 голосов
/ 06 августа 2020

Я установил pip install pytesseract и тоже установил OCR. Полная ошибка:

Traceback (most recent call last):
  File "c:/Users/Hackry/Documents/pytest/tess.py", line 2, in <module>
    import pytesseract
  File "c:\Users\Hackry\Documents\pytest\pytesseract.py", line 6, in <module>
    text = pytesseract.image_to_string(img)
AttributeError: partially initialized module 'pytesseract' has no attribute 'image_to_string' (most likely due to a circular import)

Мой код

from PIL import Image
import pytesseract
pytesseract.pytesseract.tesseract_cmd = 'C:/Users/Hackry/AppData/Local/Tesseract-OCR/tesseract.exe' #define tesseract path

img = Image.open('C:/Users/Hackry/Documents/pytest/text.jpg')
text = pytesseract.image_to_string(img)

print(text) 
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...