1、下载相关组件
安装:pip install Pillow 或下载: ,,
下载后:在C:\Python36\Scripts目录下:pip install
安装:pip3 install pytesseract 或下载安装: 或
下载: 安装,参见:
2、实例程序
#coding:utf8import osfrom PIL import Imageimport pytesseractfile=r"D:\work\python36_crawl\pictureParser\中文.png"# file=r"D:\work\python36_crawl\pictureParser\英文.png"if os.path.exists(file): image = Image.open(file) # 英文 # vcode = pytesseract.image_to_string(image,"eng") vcode = pytesseract.image_to_string(image, "chi_sim") print(vcode)
验证码相关链接: