如何为pdftotext正确安装poppler



当我尝试构建我的docker-compose pdftotext似乎失败并出现此错误:

Running setup.py install for pdftotext: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ihm5qxa9/pdftotext/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ihm5qxa9/pdftotext/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-wa_n7pgk/install-record.txt --single-version-externally-managed --compile
cwd: /tmp/pip-install-ihm5qxa9/pdftotext/
Complete output (14 lines):
WARNING: pkg-config not found--guessing at poppler version.
If the build fails, install pkg-config and try again.
running install
running build
running build_ext
building 'pdftotext' extension
creating build
creating build/temp.linux-x86_64-3.6
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPOPPLER_CPP_AT_LEAST_0_30_0=1 -I/usr/local/include/python3.6m -c pdftotext.cpp -o build/temp.linux-x86_64-3.6/pdftotext.o -Wall
pdftotext.cpp:3:10: fatal error: poppler/cpp/poppler-document.h: No such file or directory
#include <poppler/cpp/poppler-document.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1

我已经在Windows和Linux上对此进行了测试,并出现了相同的错误。有没有人找到解决这个问题的方法?

不幸的是,如果不了解docker-compose/Dockerfile的内容,就很难提供帮助。但正如错误消息中提到的,您缺少 pkg 配置。您应该尝试运行apt-get install pkg-config

您还可以查看我关于如何在 Docker 中使用最新版本的 Poppler 的答案。

相关内容

  • 没有找到相关文章

最新更新