python图像识别--验证码
1、pip3 install pyocr 2、pip3 install pillow or easy_install Pillow 4、要求python默认安装在C盘 5、找到 pytesseract.py 更改 tesseract_cmd = 'C:/Program Files/Tesseract-OCR/tesseract.exe' 代码: - <blockquote># !/usr/bin/python3.4
复制代码
如果出现错误: - 'str' does not support the buffer interface
复制代码将 `pytesseract.py` 中的下面语句更换: - lines = error_string.splitlines()
- #error_lines = tuple(line for line in lines if line.find('Error') >= 0)
- error_lines = tuple(line.decode('utf-8') for line in lines if line.find(b'Error') >= 0)
- if len(error_lines) > 0:
- return '\n'.join(error_lines)
- else:
- return error_string.strip()
复制代码如果要识别更多的文字,需要在安装tesseract-ocr的时候选择全部语言,也就1.3G 识别精度不是很高,要不就是现在的验证码太变态,人为也看不出来是什么 python图像识别--验证码
摘自:http://www.cnblogs.com/TTyb/p/5996847.html
|