How do I resolve a TesseractNotFoundError?

前端 未结 22 1897
情话喂你
情话喂你 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:36

    Install tesseract from https://github.com/UB-Mannheim/tesseract/wiki and add the path of tesseract.exe to the Path environment variable.

    0 讨论(0)
  • 2020-11-28 05:37

    Are you importing

    from tesseract import image_to_string
    

    Don't import from pytesseract

    0 讨论(0)
  • 2020-11-28 05:37

    I was also facing the same issue, just add C:\Program Files (x86)\Tesseract-OCR to your path variable. If it still does not work, add C:\Program Files (x86)\Tesseract-OCR\tessdata to your path variable in a new line. And do not forget to restart your computer after adding the path variable.

    0 讨论(0)
  • 2020-11-28 05:40

    I was also facing the same error when I was trying to make a text-extractor using pytesseract, but the solution was there in installation instructions for pytesseract in pypi site: pytesseract There are many alternatives to avoid the error, But, adding one more parameter in the method pytesseract.image_to_string solved it for me, like

    tessdata_dir_config = "/usr/share/tesseract-ocr/4.00/tessdata"
    output = pytesseract.image_to_string(image, lang='eng', config=tessdata_dir_config)
    
    0 讨论(0)
  • 2020-11-28 05:43

    CAUTION: ONLY FOR WINDOWS


    I came across this problem today and all the answers mentioned here helped me, but I personally had to dig a lot to solve it. So let me help all others by putting out the solution to it in a very simple form:

    1. Download the executable 64 bit (32-bit if your computer is of 32 bit) exe from here.

      (Name of the file would be tesseract-ocr-w64-setup-v5.0.0.20190526 (alpha))

    1. Install it. Let it install itself in the default C directory.

    2. Now go to your Environment variable (Reach there by just searching it in the start menu or Go to Control Panel > System > Advanced System Settings > Environment Variables)

    a) Select PATH and then Edit it. Click on NEW and add the path where it is installed (Usually C:\Program Files\Tesseract-OCR\)

    Now you will not get the error!

    0 讨论(0)
  • 2020-11-28 05:43

    Small mistake -- I knew I had to open/close my cmd to get the updated path to reflect. Using Jupyter Notebook I had to shutdown the client and re-initialize it also.

    0 讨论(0)
提交回复
热议问题