识别图片时报错,请指点迷津
来源: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 添加到你环境变量中去了吗?系统环境变量而不是用户环境变量
042020-08-05
相似问题