1. 错误原因

下载安装的 tesseract 的环境变量和pytesseract源文件中的相关路径没有配置好

2. 解决方案

2.1 添加环境变量

打开设置,搜索环境变量,点击新建,将安装好的 tesseract -OCR 的路径复制粘贴过来

5.png

6.jpg

2.2 修改pytesseract.py文件中的 tesseract_cmd 路径

  1. 找到 tesseract-OCR 中 tesseract.exe 文件的存储位置,复制文件路径 1.png

  2. 找到 pytesseract 的安装位置,如果是anaconda,那通常在Anaconda\Lib\site-packages路径下,找到pytesseract.py文件以后打开,将其中tesseract_cmd的路径替换为tesseract.exe的路径,修改后保存即可 2.png3.png

3. 资源链接补充

tesseract - OCR下载地址:https://digi.bib.uni-mannheim.de/tesseract/