> 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'
Why is it happening???
The problem is, you have to rename the python file to something else instead of pytesseract.py . Your python file has the same name as tesseract inbuilt function .
Can you try this?
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')))
The import statements need to be in seperate lines.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.