使用pytesseract错误

来源:2-14 使用pytesseract识别图片中得问题

weixin_慕运维6585699

2021-10-12

老师您好,
-----------------以下为代码---------------
import pytesseract
from PIL import Image

image = Image.open(“E:/imooc.png”)
print(image)
a = pytesseract.image_to_string(image)
print(a)
----------------以下运行时的错误--------------------
Traceback (most recent call last):
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pytesseract\pytesseract.py”, line 252, in run_tesseract
proc = subprocess.Popen(cmd_args, **subprocess_args())
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\subprocess.py”, line 800, in init
restore_signals, start_new_session)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\subprocess.py”, line 1207, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] 系统找不到指定的文件。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “H:/test/ZXwang/read_image.py”, line 6, in
a = pytesseract.image_to_string(image)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pytesseract\pytesseract.py”, line 417, in image_to_string
}output_type
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pytesseract\pytesseract.py”, line 416, in
Output.STRING: lambda: run_and_get_output(*args),
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pytesseract\pytesseract.py”, line 284, in run_and_get_output
run_tesseract(**kwargs)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pytesseract\pytesseract.py”, line 256, 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.

请老师您帮我看一下感谢

写回答

1回答

Mushishi

2021-10-13

 tesseract is not installed or it’s not in your PATH. See README file for more information.

tesseract 安装并且添加环境变量了吗额?软件 不是说api

0
1
weixin_慕运维6585699
非常感谢!是我没有安装环境变量
2021-10-13
共1条回复

Selenium3与Python3实战Web自动化测试框架

打破无项目经验、无框架经验瓶颈,实战Web自动化测试框架!

1890 学习 · 1093 问题

查看课程