验证码识别pytesseract

pytesseract模块支持:
链接:https://pan.baidu.com/s/1URKMjx2r8ff34-pmtmgvdQ
密码:e6fv

安装完成后需要添加运行文件到系统的环境变量当中

from PIL import Image
import requests
import pytesseract

codeurl = 'https://vis.vip.com/checkCode.php?t=0.898739192822086'
valcode = requests.get(codeurl)

f = open('checkCode.jpg', 'wb')
# 将response的二进制内容写入到文件中
f.write(valcode.content)
# 关闭文件流对象.
f.close()

im = Image.open('checkCode.jpg')
text = pytesseract.image_to_string(im)

print(text)

你可能感兴趣的:(验证码识别pytesseract)