Windows 上的 pdf2image 不断产生错误

问题描述

我正在尝试编写一些代码来从 pdf 中提取文本,并按照 pypi 上的说明在 Windows 上安装 pdf2image 和 poppler。我也改变了路径。好吧,python 上建议的命令不起作用,它不断产生以下错误

== RESTART: C:\Users\Elisabeth\AppData\Local\Programs\Python\python39\test.py ==
Traceback (most recent call last):
  File "C:\Users\Elisabeth\AppData\Local\Programs\Python\python39\lib\site-packages\pdf2image\pdf2image.py",line 441,in pdfinfo_from_path
    proc = Popen(command,env=env,stdout=PIPE,stderr=PIPE)
  File "C:\Users\Elisabeth\AppData\Local\Programs\Python\python39\lib\subprocess.py",line 951,in __init__
    self._execute_child(args,executable,preexec_fn,close_fds,File "C:\Users\Elisabeth\AppData\Local\Programs\Python\python39\lib\subprocess.py",line 1420,in _execute_child
    hp,ht,pid,tid = _winapi.CreateProcess(executable,args,FileNotFoundError: [WinError 2] Das System kann die angegebene Datei nicht finden

我使用的代码

from pdf2image import convert_from_path

from pdf2image.exceptions import (
PDFInfonotinstalledError,pdfpageCountError,PDFSyntaxError
)

images = convert_from_path(r'C:\Users\Elisabeth\Documents\Anleitungen\C:/Users/Elisabeth/Documents/Anleitungen/t490s_x390_ug_de.pdf')

我做了什么来解决问题,但没有奏效: 卸载 poppler 和 pdf2path 并重新安装。我也用过不同版本的poppler。

我只是被困住了,有没有可能寻求帮助?

谢谢

伊莱莎

解决方法

我自己解决了这个问题——因为我是 Python 的初学者,所以花了一段时间。我按照上述说明在 Windows 上安装 Poppler。我尝试了不同的方法:即使在重新启动系统后,更改路径也不起作用。我尝试安装不同版本的 Poppler,但也无济于事。所以我尝试了这个:[如何在 Windows 上安装 Poppler?][1]link。效果很好,您只需要真正注意 Poppler 文件夹中的文件夹“bin”的位置。这似乎在不同版本的 Poppler 中有所不同。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...