博客
关于我
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 subprocess.Popen 作为 Windows 上的不同用户
    查看>>
    Python subprocess.Popen() 等待完成
    查看>>
    Python sum 二维列表中具有相同第一个值的元素
    查看>>
    Python Sympy模块NoConversion:收敛到根失败;请尝试n<;15或MaxSteps>;50
    查看>>
    python time模块
    查看>>
    Python Tkinter Multiple Windows 教程
    查看>>
    Python tkinter 中的多处理
    查看>>
    Python Tkinter 笔记本小部件
    查看>>
    Python TLS版本匹配
    查看>>
    python try except finally_Python3基础 try-except-finally 的简单示例
    查看>>
    Python tweepy写入到sqlite3 db
    查看>>
    Python TypeError:格式字符串的参数不足
    查看>>
    Python UI自动化测试Page Objects企业级实战
    查看>>
    Python趣味编程:用代码创造无限可能
    查看>>
    Python UI自动化测试三方库扩展详解
    查看>>
    python谷歌翻译,2021年9月10日亲测可用,一次可以翻译十万,强烈star
    查看>>
    Python UI自动化测试数据驱动实战
    查看>>
    Python UI自动化测试集成UnitTest
    查看>>
    Python UI自动化测试集成UnitTest
    查看>>
    python unicode-escape
    查看>>