pythontesseractpython-tesseractocrmypdf

ocrmypdf not able to find tesseract path


The issue is that ocrmypdf pdf not able to find the tesseract-engine path even though I have added in the environment variables. So I need a quick solution is it possible to externally add path to the ocrmypdf.ocr() function in python.

Even imported the every required library but still it's not working Need a quick solution


Solution

  • You can define the path in your python script, e.g.:

    import pytesseract
    
    # some code to process the image
    
    pytesseract.pytesseract.tesseract_cmd=r'C:\Program Files\Tesseract-OCR\tesseract.exe'
    
    #some other code for ocr
    

    But this should not necessary, if you have in your system environment the pathname, e.g:

    C:\Program Files\Tesseract-OCR
    

    and create a variable in your system environmement, too. enter image description here