我正在尝试使用pdf2image,似乎我需要一个名为propeller的东西:
(sum_env) C:\Users\antoi\Documents\Programming\projects\summarizer>python ocr.py -i fr13_idf.pdf
Traceback (most recent call last):
File "c:\Users\antoi\Documents\Programming\projects\summarizer\sum_env\lib\site-packages\pdf2image\pdf2image.py", line 165, in __page_count
proc = Popen(["pdfinfo", pdf_path], stdout=PIPE, stderr=PIPE)
File "C:\Python37\lib\subprocess.py", line 769, in __init__
restore_signals, start_new_session)
File "C:\Python37\lib\subprocess.py", line 1172, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "ocr.py", line 53, in <module>
pdfspliterimager(image_path)
File "ocr.py", line 32, in pdfspliterimager
pages = convert_from_path("document-page%s.pdf" % i, 500)
File "c:\Users\antoi\Documents\Programming\projects\summarizer\sum_env\lib\site-packages\pdf2image\pdf2image.py", line 30, in convert_from_path
page_count = __page_count(pdf_path, userpw)
File "c:\Users\antoi\Documents\Programming\projects\summarizer\sum_env\lib\site-packages\pdf2image\pdf2image.py", line 169, in __page_count
raise Exception('Unable to get page count. Is poppler installed and in PATH?')
Exception: Unable to get page count. Is poppler installed and in PATH?我试过this link,但它并没有解决我的问题。
发布于 2018-11-29 20:57:14
pdf2image只是poppler (不是propeller!)的包装器,要使用该模块,您需要在您的计算机和路径中安装poppler-utils。
该过程在project's README的“如何安装”部分中提供了链接。
发布于 2020-12-10 22:09:07
首先,从这里here下载Poppler,然后解压代码部分,只需添加poppler_path=r'C:\Program Files\poppler-0.68.0\bin‘(例如.)如下所示
from pdf2image import convert_from_path
images = convert_from_path("mypdf.pdf", 500,poppler_path=r'C:\Program Files\poppler-0.68.0\bin')
for i, image in enumerate(images):
fname = 'image'+str(i)+'.png'
image.save(fname, "PNG")现在它的done.With,这个技巧,不需要添加环境Variables.Let我知道如果你有任何问题。
发布于 2020-06-12 14:37:47
这些pdf2image和pdftotext库的后端需求是Poppler,所以你必须安装
'conda安装-c conda-forge poppler‘
那么这个错误就会被解决。如果它仍然不能为你工作,那么你可以按照http://blog.alivate.com.au/poppler-windows/来安装这个库。
https://stackoverflow.com/questions/53481088
复制相似问题