Python验证码通过pytesser识别
2017-07-23 00:01
253 查看
Python安装包:
需要安装的包主要有两个: PIL 和 pytesser 、tesseract(1)、安装PIL:下载地址:http://www.pythonware.com/products/pil/
下载后是一个exe程序,直接双击安装
(2)、pytesser:下载地址:http://code.google.com/p/pytesser/
[b]pytesser 模块的安装:[/b]
下载后得到 “pytesser.zip”,是一个压缩文件,使用方法:
1、在 “C:\Python27\Lib\site-packages” 路径下新建一个文件夹,命名 “pytesser” 。把 “pytesser.zip” 里的文件解压到该目录:
2、将 “pytesser.py” 改名为 “__init__.py”。
3、打开 “__init__.py” 文件,修改:tesseract_exe_name = 'C:\\Python27\\Lib\\site-packages\\pytesser\\tesseract' # Name of executable to be called at command line
4、pytesser 模块依赖于 PIL 模块,如果是按照上面的方法安装 PIL 的话,需要把 “init.py” 文件里的 “import Image” 改成 “from PIL import Image” 。
下载解压后直接放C:\Python27\Lib\site-packages,同时,新建一个pytesser.pth,内容就写,注意这里的内容一定要和pytesser这个文件夹同名,意思就是pytesser文件夹,pytesser.pth,及内容都要一样!
![](https://images2015.cnblogs.com/blog/707331/201707/707331-20170722235823559-1323860340.png)
(3)、Tesseract OCR engine下载:http://code.google.com/p/tesseract-ocr/
下载后解压,tessdata文件夹,用其替换掉pytesser解压后的tessdata文件夹即可。(就上面的pytesser文件夹)
代码如下:
1 #-*- coding:utf-8 -*- 2 __author__ = "carry" 3 from PIL import Image 4 from pytesser import * 5 6 image = Image.open('xx.jpg') 7 print image_to_string(image)
相关文章推荐
- Python2.7+pytesser简单验证码的识别
- Python2.7+pytesser实现简单验证码的识别方法
- Python验证码识别:利用pytesser识别简单图形验证码
- Python验证码识别:利用pytesser识别简单图形验证码
- Python2.7+pytesser简单验证码的识别
- Python验证码识别:利用pytesser识别简单图形验证码
- Python验证码识别:利用pytesser识别简单图形验证码
- Python验证码识别:利用pytesser识别简单图形验证码
- Python 识别CSDN官网的验证码
- python爬虫scrapy框架——人工识别登录知乎倒立文字验证码和数字英文验证码(1)
- python人工智能写验证码自动识别demo地址
- 基于Python使用SVM识别简单的字符验证码的完整代码开源分享
- python pytesser 识别图片验证码
- 用Python进行简单图像识别(验证码)
- python3 + pytesser3 识别验证码过程中‘gbk'’编码问题的解决
- 使用python以及工具包进行简单的验证码识别
- Python识别平台登录验证码
- 通过OCR实现对简单验证码的识别技术
- 基于Python的Selenium自动化(3)— 实现验证码截取并识别
- Python+Selenium+PIL+Tesseract真正自动识别验证码进行一键登录