问题:pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it’s not in your PATH.
1 电脑安装tesseract
tesseract下载地址
一路默认安装,最后安装地址选择了D盘
配置path环境变量
cmd中 输入tesseract,安装成功
2 python 依赖包
conda install pytesseract
# encoding: utf-8
from PIL import Image
import pytesseract
imageurl = './index.png'
image = Image.open(imageurl)
# 转为会读图像
grayIMG = image.convert('L')
# 对图像进行二值化处理
threshold = 127
print(grayIMG,'grayimage')
binary_image = grayIMG.point(lambda p: p>threshold and 225)
# 使用tesseract ocr进行数字识别
code = pytesseract.image_to_string(binary_image,config='--psm 10 --oem 3 -c tessedit_char_whitelist=0123456789')
# print('result is ***',code)
还是报错
File “D:\anaconda\Lib\site-packages\pytesseract\pytesseract.py”,
line 280, in run_tesseract
raise TesseractNotFoundError() pytesseract.pytesseract.TesseractNotFoundError: tesseract is not
installed or it’s not in your PATH. See README file for more
information.
打开报错文件,pytesseract.py,重新配置tesseact地址
文章来源:https://www.toymoban.com/news/detail-777571.html
tesseract_cmd = r'D:/Program Files/Tesseract-OCR/tesseract.exe'
再次运行测试代码,可以跑通文章来源地址https://www.toymoban.com/news/detail-777571.html
到了这里,关于python报错:tesseract is not installed or it‘s not in your PATH.的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!