pytesseract cannot find the file specified

二次信任 提交于 2019-11-27 13:36:55

Just hit the same error and decided to answer this question - it might help someone to save time...

First, make sure you have installed/copied Tesseract-OCR executables.

Windows can't find the executable tesseract in the directories specified in your PATH environment variable. So either make sure that the directory containing tesseract is in your PATH variable or overwrite tesseract_cmd variable in your Python script like as following (put your PATH instead):

import pytesseract

pytesseract.pytesseract.tesseract_cmd = 'C:/Program Files (x86)/Tesseract-OCR/tesseract'

Beside that make sure that TESSDATA_PREFIX Windows environment variable is set to the directory, containing tessdata directory. For example:

TESSDATA_PREFIX=C:\Program Files (x86)\Tesseract-OCR

if tessdata location is: C:\Program Files (x86)\Tesseract-OCR\tessdata

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!