tesseract is not installed or it's not in your PATH

Tesseract-OCR已经安装

$ tesseract -v
tesseract v5.2.0.20220708
 leptonica-1.78.0
  libgif 5.1.4 : libjpeg 8d (libjpeg-turbo 1.5.3) : libpng 1.6.34 : libtiff 4.0.9 : zlib 1.2.11 : libwebp 0.6.1 : libopenjp2 2.3.0
 Found AVX
 Found SSE4.1
 Found libarchive 3.5.0 zlib/1.2.11 liblzma/5.2.3 bz2lib/1.0.6 liblz4/1.7.5 libzstd/1.4.5
 Found libcurl/7.74.0 OpenSSL/1.0.2o (Schannel) zlib/1.2.11 zstd/1.4.5 WinIDN libssh2/1.7.0 nghttp2/1.31.0

但是使用 pytesseract.image_to_string()时报错

  pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it's not in your PATH. See README file for more information.

问题产生的原因:

  没有找到 tesseract.exe 的位置

找到 pytesseract源码

tesseract_cmd = 'tesseract'

修改为Tesseract-OCR安装的目录,如:

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

 

posted @ 2022-09-16 12:25  慕尘  阅读(787)  评论(0编辑  收藏  举报