How do I resolve a TesseractNotFoundError? How do I resolve a TesseractNotFoundError? python python

How do I resolve a TesseractNotFoundError?


I got this error because I installed pytesseract with pip but forget to install the binary.

On Linux

sudo apt updatesudo apt install tesseract-ocrsudo apt install libtesseract-dev

On Mac

brew install tesseract

On Windows

download binary from https://github.com/UB-Mannheim/tesseract/wiki. then add pytesseract.pytesseract.tesseract_cmd = 'C:\\Program Files (x86)\\Tesseract-OCR\\tesseract.exe' to your script. (replace path of tesseract binary if necessary)

references:https://pypi.org/project/pytesseract/ (INSTALLATION section) and https://github.com/tesseract-ocr/tesseract/wiki#installation


I tried adding to the path variable like others have mentioned, but still received the same error. what worked was adding this to my script:

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


You are probably missing tesseract-ocr from your machine. Check the installation instructions here: https://github.com/tesseract-ocr/tesseract/wiki

On a Mac, you can just install using homebrew:

brew install tesseract

It should run fine after that