pdftotext库是requirements.txt中的一个需求。当我试图推到heroku时,我得到了以下错误:
remote: Running setup.py install for pdftotext: started
remote: Running setup.py install for pdftotext: finished with status 'error'
remote: Complete output from command /app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-rnbekz45/pdftotext/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-o0if2tl3-record/install-record.txt --single-version-externally-managed --compile:
remote: /app/.heroku/python/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
remote: warnings.warn(msg)
remote: running install
remote: running build
remote: running build_ext
remote: building 'pdftotext' extension
remote: creating build
remote: creating build/temp.linux-x86_64-3.6
remote: gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPOPPLER_CPP_AT_LEAST_0_30_0=0 -I/app/.heroku/python/include/python3.6m -c pdftotext.cpp -o build/temp.linux-x86_64-3.6/pdftotext.o -Wall
remote: pdftotext.cpp:3:10: fatal error: poppler/cpp/poppler-document.h: No such file or directory
remote: #include <poppler/cpp/poppler-document.h>
remote: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
remote: compilation terminated.
remote: error: command 'gcc' failed with exit status 1
remote:
remote: ----------------------------------------
remote: Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-rnbekz45/pdftotext/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-o0if2tl3-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-rnbekz45/pdftotext/
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed通常,我会通过用libpoppler-cpp-dev安装apt来解决这个问题。但在heroku上,我没有根访问权限。有什么解决办法吗?
严格来说,我意识到这不是一个程序问题。但是我需要这个来部署我的程序,所以我希望这里的纯粹主义者原谅我。
发布于 2019-01-23 12:24:33
我们不提供官方支持来安装额外的软件包,但有几个不受支持的选项。 一种是实验heroku-apt-buildpack。您可以通过在应用程序中的
Aptfile中包含任何APT包来使用它。然后,当部署应用程序时,buildpack将在dyno上安装这些包。
因此,要做到这一点,首先添加构建包:
heroku buildpacks:add --index 1 heroku-community/apt然后,在源目录中创建一个具有以下内容的Aptfile:
libpoppler-cpp-dev像你平时一样部署。如果这有帮助的话请告诉我!
https://stackoverflow.com/questions/54327005
复制相似问题