AttributeError的:模块 'pytesseract' 有没有属性 'image_to_string'
问题描述:
> import image
> import pytesseract as pya
>
> pya.tesseract_cmd = r'C:\Users\Euphz\Documents\Artworks\PSD\Speaking
of Dogs\201710'
> print(pya.image_to_string(image.open('doggieville.png')))
Traceback (most recent call last): File "C:\PythonProjects\pytesseract.py", line 2, in import pytesseract as pya File "C:\PythonProjects\pytesseract.py", line 5, in print(pya.image_to_string(image.open('doggieville.png'))) AttributeError: module 'pytesseract' has no attribute 'image_to_string'AttributeError的:模块 'pytesseract' 有没有属性 'image_to_string'
为什么会发生???
答
你可以试试吗?
import image
import pytesseract as pya
pya.tesseract_cmd = r'C:\Users\Euphz\Documents\Artworks\PSD\Speaking
of Dogs\201710'
print(pya.image_to_string(image.open('doggieville.png')))
导入语句需要单独行。
谢谢。当我粘贴它时,这是一个错字。 – Phemia
当他们分开时,它不工作。 – Phemia