Search code examples
pythonpython-tesseract

How to solve Tesseract Not Found Error, Anaconda?


So my conda version is 4.8.3 I'm new to tesseract and anaconda installed. Installed tesseract using the following command:

`conda install -c conda-forge pytesseract`
`conda install -c conda-forge/label/cf202003 pytesseract `

Now when i try to run a simple image to ocr code I get the following error

File "C:\Users\user\Anaconda3\lib\site-packages\pytesseract\pytesseract.py", line 232, in run_tesseract raise TesseractNotFoundError()

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


Solution

  • 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).