python - f"{tesseract_cmd} 未安装或不在您的 PATH 中。"
问题描述
因此,我遵循了有关使用 python 使用 tesseract 的教程,并且我已经从https://github.com/UB-Mannheim/tesseract/wiki安装了 tesseract
并使用:
pytesseract.pytesseract.tesseract_cmd = r"C:\Program Files\Tesseract-OCR\tesseract.exe"
在 python 文件中,但仍然得到这样的结果:
Traceback (most recent call last):
File ".\testBase.py", line 3, in <module>
import pytesseract
File "C:\Python27\lib\site-packages\pytesseract\__init__.py", line 2, in <module>
from .pytesseract import ALTONotSupported
File "C:\Python27\lib\site-packages\pytesseract\pytesseract.py", line 89
f"{tesseract_cmd} is not installed or it's not in your PATH."
^
SyntaxError: invalid syntax
而且我正在寻找如何解决它,比如将 tesseract.exe 添加到 PATH 但仍然没有工作。我什至不能在 cmd 上使用 tesseract 命令
有没有我错过的步骤?
谢谢
解决方案
我已经通过将 python 版本从 2.7 更新到 3.9 来修复错误
推荐阅读
- javascript - 如何在 JavaScript 中为非常旧的日期(大约公元 0 年)格式化初始化字符串?
- javascript - 如何使用 onclick 功能停止 gsap.to 动画?
- java - 从 Object 类型对象 (Spring) 中获取字段值
- python - 找不到使用硒单击的按钮
- c# - 如何覆盖或删除现有的 vs 代码片段
- typescript - 如何在打字稿上为动态对象定义预期的属性类型
- javascript - 需要遍历数组以获取特定的键:值对以添加到空对象
- pandas - Pandas 部分字符串排序和分位数
- vim - 如何仅在帮助页面上进行 Vim 映射
- selenium - Selenium WebDriverWait 不断抛出 TimeoutException