[Python] MAC uses the picture recognition pytesseract method to report an error

1、 Premise:

Pyteseract image recognition is used in Python, and an error is reported:

pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it’s not in your path

2、 Solution

Cause of problem:

Installed pytesseract using pip, but forgot to install the Tesseract binary.

First, go to the pytesseract.py file and find it

tesseract_cmd

Change the path

 

 

Amend to read:

 

 

 

[transfer]

1. Installation command on Linux

sudo apt update
sudo apt install tesseract-ocr
sudo apt install libtesseract-dev

2. MAC installation command

brew install tesseract

3. Installation command on Windows

from https://github.com/UB-Mannheim/tesseract/wiki Download binaries. Then add pytesseract.pytesseract.tesseract_ CMD = 'C: \ \ program files (x86) \ \ Tesseract OCR \ \ Tesseract. Exe' into the script. (if necessary, replace the path of the Tesseract binary file)

 

 

Article reference:

Thanks for Levi’s article: how to use pytesseractnotfounderror (Tesseract OCR) in Python

Similar Posts: