博客
关于我
pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it‘s not in your path
阅读量:805 次
发布时间:2023-03-05

本文共 679 字,大约阅读时间需要 2 分钟。

在Windows环境下使用pytesseract识别验证码时,可能会遇到以下错误:

pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it’s not in your path

这个错误提示表明,Tesseract OCR软件未安装或未被正确添加到Python的环境路径中。以下是解决方案:

  • 确认Tesseract的安装路径

    打开终端或命令提示符,输入以下命令以查找Tesseract的安装路径:

    path

    查找完成后,找到包含Tesseract-OCR的文件夹路径,例如:

    C:\Program Files\Tesseract-OCR
  • 配置pytesseract的Tesseract命令

    打开Python文件或脚本,找到pytesseract的配置部分,查找tesseract_cmd变量。默认值通常是'tesseract',但需要更新为实际安装路径。
    例如:

    tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'

    确保路径正确,必要时使用反斜杠或r''包裹,避免路径解析错误。

  • 运行脚本

    确认配置无误后,运行脚本,应该不会再出现TesseractNotFoundError。

  • 注意事项:

    • 确保Tesseract OCR软件已安装,且路径正确。
    • 如果Tesseract安装在不同位置,需要手动更新路径。
    • 建议将Tesseract添加到系统环境变量中,以便所有脚本都能正确识别。

    转载地址:http://rcafk.baihongyu.com/

    你可能感兴趣的文章
    python 内置slice的用法
    查看>>
    Python 内置时间模块
    查看>>
    python 内部如何实现命名元组?
    查看>>
    Python 写Android App性能:入门到高级
    查看>>
    python 写入json数据到数据库
    查看>>
    Python 出现 TypeError: ‘encoding‘ is an invalid keyword argument for this function 解决方法
    查看>>
    python 出现 TypeError: ‘list‘ object is not callable 的解决方法
    查看>>
    python 函数1
    查看>>
    python 函数学习
    查看>>
    Python 函数随笔 map()函数,lambda自定义函数
    查看>>
    Python 分析天气,告诉你中秋应该去哪里
    查看>>
    python 列表中dict中key排序
    查看>>
    python 列表函数
    查看>>
    Python 列表删除相同的元素
    查看>>
    python 列表生成式
    查看>>
    Python 列表解析 大文件
    查看>>
    python 列表转字典方法
    查看>>
    Python 列表(List)概述-ChatGPT4o作答
    查看>>
    Python网络爬虫基础进阶到实战教程
    查看>>
    Python 初学者需要知道的四条建议
    查看>>