Add Poppler to Path in Debian

2019-09-06 12:48发布

问题:

I have just installed poppler on my debian server using the command:

sudo apt-get install poppler-utils

However, when I execute the command:

pdftocairo --help

The function cannot be found, so I assume this program has not automatically linked into my PATH variable. My issue is that I am not very experienced with Linux and I don't know how to find out where poppler installed, nor how to create a link file to Poppler from an existing included PATH location.

Any help would be appreciated, especially if someone can explain how I know where these programs are installing themselves.

回答1:

you should not need to do anything with the PATH - it's the maintainer's task to make everything work "as expected".

your problem could have several reasons:

  • your version of poppler-utils does not come with the pdftocairo binary
  • your version of poppler-utils insatlls pdftocairo into a path that is not in your PATH
  • you (or somebody else) have messed with the PATH, so it doesn't contain the directory where poppler-utils installed the binaries to any more.

so first check whether poppler-utils installs the file (and where to). the following will give you a list of all files installed by the package:

$ dpkg -L poppler-utils
[...]
/usr/bin/pdftops
/usr/bin/pdftocairo
/usr/bin/pdftohtml
[...]

as you can see, on my system - which has poppler-utils 0.18.4-6 installed - the package installed a pdftocairo into /usr/bin which is the default path for all applications, and which should already be in your PATH.

to check your PATH variable do something like

$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games

as you can see, my PATH contains /usr/bin, and indeed i can do:

$ pdftocairo --help
pdftocairo version 0.18.4
Copyright 2005-2011 The Poppler Developers - http://poppler.freedesktop.org
Copyright 1996-2004 Glyph & Cog, LLC
[...]

if your PATH does not contain /usr/bin, then something is seriously wrong with your system (for instance, you have tried changing your path and accidentally removed all the previous settings).

in any case, adding a new path to PATH is quite simple; all paths are separated by colons, so you should do something like the following:

$ export PATH=/path/to/my/bin:${PATH}

this will add /path/to/my/bin/ at the beginning of the search-path, so all binaries will now be searched first in /path/to/my/bin/ and then /usr/local/bin and so forth.