python 图片识别

安装库
pip install pytesseract
pip install Pillow

windows安装 tesseract 中文识别
下载地址:https://digi.bib.uni-mannheim.de/tesseract/
运行安装:tesseract-ocr-setup-4.00.00dev.exe
安装路径:C:\Anaconda3\Tesseract-OCR
安装完成后设置环境变量
1、添加环境变量
python 图片识别
2、添加系统变量
python 图片识别
重启

from PIL import Image
import pytesseract
text=pytesseract.image_to_string(Image.open('xxx.jpg'),lang='chi_sim') # 使用中文
print(text)

猜你喜欢

转载自blog.51cto.com/zhizhimao/2344728