使用pytesseract识别验证码中遇到tesseract is not installed or it's not in your path解决方案


在windows操作系统中,当使用pytesseract对图像中的验证码进行识别时会遇到以下问题:

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

给出以下解决方案:

(1)首先下载tesseract-ocr。

下载地址为蓝奏云网盘:https://wws.lanzous.com/iFyShmujych
密码:5nc2

下载成功之后,对下图所示的文件进行安装, 不过在安装时要记住安装的目录。

(2)安装文件

安装成功之后,打开安装的文件所在的目录。例如我的安装目录为:S:\Programs\Python\Python37-32\Tesseract-OCR\tesseract.exe。

(3)配置路径

对画红圈的地方中的‘tesseract’修改为安装tesseract-ocrde的安装目录。我安装在D:\tesseract\Tesseract-OCR\tesseract.exe

重新运行程序即可。

from PIL import Image
import pytesseract
 
num_1 = Image.open(r'.\imgs\2.png')
print(pytesseract.image_to_string(num_1))

原文地址https://blog.csdn.net/weixin_41644725/article/details/9534492


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM