我做了pip安装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)
目前没有回答
相关问题 更多 >
编程相关推荐