Python tesseract is not installed or it’s not in your path 错误解决方案

  • 转载请注明出处!
     
  • 个人博客:http://www.forever121.cn/

使用 pytesseract.image_to_string() 函数时,报错如下:

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

原因是没有找到 Tesseract-OCR\tesseract.exe 的位置

打开pytesseract源码

查找 tesseract_cmd = 'tesseract'

发现上面有一行注释 # CHANGE THIS IF TESSERACT IS NOT IN YOUR PATH, OR IS NAMED DIFFERENTLY

由于 TESSERACT 所在目录不同,需要手动更改目录

此行修改为

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

如果没有Tesseract-OCR 需要手动安装

http://digi.bib.uni-mannheim.de/tesseract/tesseract-ocr-setup-4.00.00dev.exe

下载完安装即可,默认路径 C:\Program Files (x86)\ 下面

 

 

你可能感兴趣的:(Python tesseract is not installed or it’s not in your path 错误解决方案)