简体   繁体   中英

pdf2image on windows keeps producing error

I am trying to write some code to extract text from pdf and followed the directions on pypi to install pdf2image and poppler on windows. I also changed Path. Well, the suggested command on python does not work, it keeps producing the following error:

== 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

The code I used:

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')

What I did to solve the problem, but did not work: uninstalling poppler and pdf2path and installing it again. I also used different versions of poppler.

I am just stuck, is there the possibility for some help?

Thank`s

Elaisa

I solved the problem myself - since I am a beginner at Python it took a while. I followed the mentioned instructions to install Poppler on Windows. I tried out different things: What did not work was changing path, even after restarting the system. I tried to install different versions of Poppler, that did not help either. So I tried this: [How to install Poppler on Windows?][1] link . That worked very well, you just have to really watch out where the folder "bin" within the Poppler folder is. This seems to differ in the different versions of Poppler.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM