识别图片时报错,请指点迷津

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

慕粉4484258

2020-08-03

import pytesseract
from PIL import Image

image = Image.open(“E:/imooc1.png”)
text =pytesseract.image_to_string(image)
print(text)
执行以上代码时报错

Traceback (most recent call last):
File “D:\untitled\venv\lib\site-packages\pytesseract\pytesseract.py”, line 238, in run_tesseract
proc = subprocess.Popen(cmd_args, **subprocess_args())
File “D:\cglj\python\lib\subprocess.py”, line 709, in init
restore_signals, start_new_session)
File “D:\cglj\python\lib\subprocess.py”, line 997, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] 系统找不到指定的文件。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “D:/untitled/liliwei/read_image.py”, line 5, in
text =pytesseract.image_to_string(image)
File “D:\untitled\venv\lib\site-packages\pytesseract\pytesseract.py”, line 360, in image_to_string
}output_type
File “D:\untitled\venv\lib\site-packages\pytesseract\pytesseract.py”, line 359, in
Output.STRING: lambda: run_and_get_output(*args),
File “D:\untitled\venv\lib\site-packages\pytesseract\pytesseract.py”, line 270, in run_and_get_output
run_tesseract(**kwargs)
File “D:\untitled\venv\lib\site-packages\pytesseract\pytesseract.py”, line 242, in run_tesseract
raise TesseractNotFoundError()
pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it’s not in your PATH

Process finished with exit code 1

写回答

1回答

Mushishi

2020-08-04

你的tesseract 添加到你环境变量中去了吗?系统环境变量而不是用户环境变量

0
4
慕粉4484258
回复
Mushishi
回复 Mushishi也对哦,这个我还真没想到,老师您在帮我看下下面这个错误 Traceback (most recent call last): File "D:/untitled/liliwei/read_image.py", line 4, in r = ShowapiRequest("http://route.showapi.com/2360-1","314848","f1e789c973e546d4ae6da6071e339aaa" ) TypeError: 'module' object is not callable
2020-08-05
共4条回复

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

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

1883 学习 · 1093 问题

查看课程