python -使用pytesseract识别验证码中遇到的问题

使用pytesseract识别验证码中遇到异常如下:

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

检查源码,发现如下说明:

# CHANGE THIS IF TESSERACT IS NOT IN YOUR PATH, OR IS NAMED DIFFERENTLY

tesseract_cmd = 'tesseract'

从网上找到相应的‘Tesseract-OCR’下载安装(寻找对应版本):https://github.com/tesseract-ocr/tesseract/wiki


安装后的默认文件路径为(这里使用的是Windows版本):C:\Program Files (x86)\Tesseract-OCR\

然后将源码中的:

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


再次运行之前的PY脚本,成功.





猜你喜欢

转载自blog.csdn.net/wang_hugh/article/details/80760940