用PIL+pytesseract+ORC 识别
【1】需要安装的模块
pip3 install pollow
pip3 install pytesser3
pip3 install pytesseract
pip3 install wheel
安装识别引擎tesseract-ocr
注:这种识别率不高
import pytesseract
from PIL import Image
im=Image.open('text.png') #打开图片
image = im.convert('L') #图片灰度处理
print(pytesseract.image_to_string(im))#默认识别英文和数字
print(pytesseract.image_to_string(im,lang='chi_sim')) #识别中文,需要下载sim文件,