Python 使用PyteSeract执行OCR时出错

Python 使用PyteSeract执行OCR时出错,python,python-3.x,ocr,python-tesseract,Python,Python 3.x,Ocr,Python Tesseract,我想用pytesseract。这是我的密码 import pytesseract from pdf2image import convert_from_path PDF_file = 'file.pdf' text = '' pages = convert_from_path(PDF_file, 500) pageText = str(((pytesseract.image_to_string(pages[0])))) 结果我得到了这个错误 回溯(最近一次呼叫最后一次): 文件“C:

我想用pytesseract。这是我的密码

import pytesseract 
from pdf2image import convert_from_path 

PDF_file = 'file.pdf'
text = '' 
pages = convert_from_path(PDF_file, 500)
pageText = str(((pytesseract.image_to_string(pages[0])))) 
结果我得到了这个错误

回溯(最近一次呼叫最后一次): 文件“C:\Users\user\AppData\Local\Programs\Python38-32\lib\site packages\pdf2image\pdf2image.py”,第409行,位于pdfinfo\u from\u路径中 proc=Popen(命令,env=env,stdout=PIPE,stderr=PIPE) 文件“C:\Users\user\AppData\Local\Programs\Python38-32\lib\subprocess.py”,第854行,位于init self.\u execute\u child(参数、可执行文件、预执行文件、关闭文件、, 文件“C:\Users\user\AppData\Local\Programs\Python38-32\lib\subprocess.py”,第1307行,在执行子进程中 hp、ht、pid、tid=\u winapi.CreateProcess(可执行文件、参数、, FileNotFoundError:[WinError 2]系统找不到指定的文件

在处理上述异常期间,发生了另一个异常:

回溯(最近一次呼叫最后一次): 文件“C:\Users\user\Desktop\projects\pdfparser\pdftest.py”,第13行,在 pages=从路径转换路径(PDF文件,500) 文件“C:\Users\user\AppData\Local\Programs\Python38-32\lib\site packages\pdf2image\pdf2image.py”,第89行,在convert\u from\u路径中 page_count=pdfinfo_from_path(pdf_path,userpw,poppler_path=poppler_path)[“Pages”] 文件“C:\Users\user\AppData\Local\Programs\Python38-32\lib\site packages\pdf2image\pdf2image.py”,第430行,位于pdfinfo_from_路径中 提升PDFinFoNotInstallerRor( pdf2image.exceptions.PDFInfoNotInstalledError:无法获取页面计数。是否已安装poppler并在路径中


正如许多评论已经指出的,错误消息

PdfinFoNotInstallerRor(pdf2image.exceptions.PdfinFoNotInstallerRor:无法获取页面计数。是否已安装poppler并在路径中

准确地告诉您出了什么问题:未安装Poppler。请参阅该侧的以获取帮助


你看,
pdf2image
只是命令行实用程序的一个包装。在Linux上它是默认安装的,所以你不需要麻烦它,但在Windows上它不是。

系统找不到file.pdf。它是否在启动脚本的同一个目录中?是否安装了poppler并在路径中?是的都在同一个目录下,但波普勒在路径上吗?@NicolasGervais不,我加上它,它就工作了