Python 官方文档:入门教程 => 点击学习
具体想要实现上面的代码需要安装两个包和一个引擎 在安装之前需要先安装好python,pip并配置好环境变量 1.第一个包: pytesseract pip install pytesseract 若是出现安装错误的情况,安装
具体想要实现上面的代码需要安装两个包和一个引擎
在安装之前需要先安装好python,pip并配置好环境变量
1.第一个包: pytesseract
pip install pytesseract
若是出现安装错误的情况,安装不了的时候,可以将命令改为 pip.exe install pytesseract来安装
若是将pip修改为pip.exe安装成功后,那么下文的所有pip都需要改为pip.exe
2.第二个包:PIL安装
pip install PIL
若是失败了可以如下修改 pip install PILLOW
3.安装识别引擎tesseract-ocr
下载 tesseract-ocr,进行默认安装 下载地址点击这里
from PIL import Image
import pytesseract
imageObject=Image.open('D://new.jpg')
print (imageObject)
print (pytesseract.image_to_string(imageObject))
识别图片
我们发现运行时报错了
解决方法(D:/Python 该路径为Python安装位置,因人而异)
D:/Python/Lib/site-packages/pytesseract 下的 pytesseract.py文件做如下修改
执行成功看下结果:
--结束END--
本文标题: 【Python】Python简单的图片识
本文链接: https://www.lsjlt.com/news/190238.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0