1,安装有四种方式:
brew install --with-training-tools tesseract //安装tesseract, 同时安装训练工具
brew install --all-languages tesseract //安装tesseract,同时它还会安装所有语言
brew install --all-languages --with-training-tools tesseract //安装附加组件
brew install tesseract //安装tesseract,但是不安装训练工具,我选择这种方式进行安装
2.pip install pytesseract pillow
def checkcode(path):
"""
验证码识别
:param path:
:return:
"""
import pytesseract
from PIL import Image
image = Image.open(path)
code = pytesseract.image_to_string(image)
return code