- 安装pytesseract
pip insatll pytesseract
- 安装Tesseract-OCR(https://github.com/tesseract-ocr/tesseract)
安装完后将Tesseract-OCR的安装路径添加到环境变量中PATH和Path中,都要添加。
- 重启
使用:
from PIL import Image
import pytesseract
image = Image.open('2.png')
c = pytesseract.image_to_string(image)
print(c)