How to Resolve a Tesseractnotfounderror

Pytesseract : TesseractNotFound Error: tesseract is not installed or it's not in your path, how do I fix this?

I see steps are scattered in different answers. Based on my recent experience with this pytesseract error on Windows, writing different steps in sequence to make it easier to resolve the error:

1. Install tesseract using windows installer available at: https://github.com/UB-Mannheim/tesseract/wiki

2. Note the tesseract path from the installation. Default installation path at the time of this edit was: C:\Users\USER\AppData\Local\Tesseract-OCR. It may change so please check the installation path.

3. pip install pytesseract

4. Set the tesseract path in the script before calling image_to_string:

pytesseract.pytesseract.tesseract_cmd = r'C:\Users\USER\AppData\Local\Tesseract-OCR\tesseract.exe'

Pytesseract TesseractNotFoundError [Python 3]

The error occurred because the code is compiled using python3 but the module was installed using pip.

So the pytesseract module was installed to Python2 instead of Python3.

Installing using pip3 would solve the problem.

TesseractNotFoundError: tesseract is not installed or it's not in your path

Step 1: Download and install Tesseract OCR from this link.

Step 2: After installing find the "Tesseract-OCR" folder, double Click on this folder and find the tesseract.exe.

Step 3: After finding the tesseract.exe, copy the file location.

Step 4: Pass this location into your code like this

pytesseract.pytesseract.tesseract_cmd = r"C:\Program Files\Tesseract-OCR\tesseract.exe"

Note: C:\Program Files\Tesseract-OCR\tesseract.exe == your copied location

How to solve Tesseract Not Found Error, Anaconda?

You see this error because you don't have tesseract executable in your PATH. So you have to include the following line:

pytesseract.pytesseract.tesseract_cmd = r'C:\\Program Files\\Tesseract-OCR\\tesseract.exe'

You can see an example in the Official documentation of pytesseract.

I wrote the default tesseract executable folder, but if you have changed it, remember to use the <full_path_to_your_tesseract_executable> (as suggested in the previous link).



Related Topics



Leave a reply



Submit