Я установил 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)