1、Windows环境安装tesseract-ocr 4.00并配置环境变量

https://blog.csdn.net/jiahao1186/article/details/90207881

2、python环境安装插件

 pip install Pillow

 pip install pytesseract

3、配置tesseract

目录:D:\Programs\Python\Lib\site-packages\pytesseract

文件:pytesseract.py

解决:python解析验证码

4、图片

解决:python解析验证码

5、代码

from PIL import Image
import pytesseract

imageObject = Image.open('E:/IMG/timg.jpg')
print(imageObject)
print(pytesseract.image_to_string(imageObject))

6、结果

<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=400x218 at 0x21402766BA8>
N 9 A m

7、异常情况

如果有异常,应该是之前的配置尚未生效,请尝试重启,再试之。

说明:该工具类对简单验证码解析成功,负责的,可能会有困难,还需补充算法实现。

常见问题:

https://blog.csdn.net/qq_39208536/article/details/80763972

相关文章:

  • 2022-12-23
  • 2022-01-21
  • 2021-05-18
  • 2022-12-23
  • 2021-07-21
  • 2022-12-23
  • 2022-12-23
  • 2021-08-24
猜你喜欢
  • 2022-12-23
  • 2021-10-09
  • 2022-12-23
  • 2022-01-15
  • 2022-02-13
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案