美文网首页
验证码识别

验证码识别

作者: 唐小风7 | 来源:发表于2019-10-08 10:29 被阅读0次

环境安装:

工欲善其事,必先利其器。

  • python3
    brew install imagemagick
    brew install tesseract
    pip3 install tesserocr pillow

  • python2
    sudo pip install image
    sudo pip install tesserocr

测试代码:

#!/usr/bin/env python
# coding=utf-8
import tesserocr

print(tesserocr.file_to_text('image.png'))

运行故障:

导入tesserocr时命令行报错如上,无法导入。

解决方案:
运行程序前命令行运行:export LC_ALL=C
或配置进~/.bash_profile
执行相应的source命令即可

测试结果


相关文章

网友评论

      本文标题:验证码识别

      本文链接:https://www.haomeiwen.com/subject/enbvyctx.html