Fix pytesseract.pytesseract.TesseractNotFoundError for Beginners – Python Tutorial

By | September 9, 2019

When we are using python pytesseract library to extract text from an image, we may encounter this error: pytesseract.pytesseract.TesseractNotFoundError. In this tutorial, we will introduce how to fix this error for you.


Why this error occur?

Python pytesseract library will call tesseract.exe to extract text from an image, if it can not find this .exe file, pytesseract.pytesseract.TesseractNotFoundError will be reported.

How to fix this error?

To fix this error, you should install Tesseract OCR and set it into you system environment, then reboot your computer.

If your computer operation is win 10, you can refer to this tutorial.

A Beginner Guide to Use Tesseract OCR to Extract Text From Images on Windows 10 – Tesseract OCR Tutorial

However, if you don’t want to set system environment for Tesseract OCR, you can add this code in your python script.

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

Where C:\Program Files\Tesseract-OCR\tesseract.exe is the absolute path of tesseract.exe, you can change it to yours.

Then this error is also can be fixed.

Leave a Reply

Your email address will not be published. Required fields are marked *