How do I resolve a TesseractNotFoundError?

前端 未结 22 2130
情话喂你
情话喂你 2020-11-28 05:14

I am trying to use pytesseract in Python but I always end up with the following error:

    raise TesseractNotFoundError()
pytesseract.pytesseract.TesseractNo         


        
22条回答
  •  爱一瞬间的悲伤
    2020-11-28 05:58

    I faced the same problem. I hope you have installed from here and have also done pip install pytesseract.

    If everything is fine you should see that the path C:\Program Files (x86)\Tesseract-OCR where tesseract.exe is available.

    Adding Path variable did not helped me, I actually added new variable with name tesseract in environment variables with a value of C:\Program Files (x86)\Tesseract-OCR\tesseract.exe.

    Typing tesseract in the command line should now work as expected by giving you usage informations. You can now use pytesseract as such (don't forget to restart your python kernel before running this!):

    import pytesseract
    from PIL import Image
    
    value=Image.open("text_image.png")
    text = pytesseract.image_to_string(value, config='')    
    print("text present in images:",text)
    

    enjoy!

提交回复
热议问题