1.下载tesseract
https://digi.bib.uni-mannheim.de/tesseract/
2.配置环境变量
path
D:\Program Files (x86)\Tesseract-OCR
TESSDATA_PREFIX变量名
D:\Program Files (x86)\Tesseract-OCR\tessdata
3.打开cmd
tesseract -v
4.python脚本
from PIL import Image import pytesseract text = pytesseract.image_to_string(Image.open(r'D:\image.png')) print(text)