【问题标题】:Installing pdftotext library on heroku在heroku上安装pdftotext库
【发布时间】:2019-01-23 12:12:22
【问题描述】:

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-devapt 来解决这个问题。但是在heroku上,我没有root访问权限来做到这一点。有解决办法吗?

我意识到严格来说,这不是一个编程问题。但是我需要这个来部署我的程序,所以我希望这里的纯粹主义者原谅我。

【问题讨论】:

    标签: python heroku pdftotext


    【解决方案1】:

    来自How do I install additional software packages that my application requires?

    我们不提供安装额外软件包的官方支持,但有几个不受支持的选项。

    一个是实验性的heroku-apt-buildpack。您可以通过在应用程序的Aptfile 中包含任何APT 包来使用它。当你部署你的应用程序时,buildpack 会在 dyno 上安装这些包。

    所以,要做到这一点,首先添加构建包:

    heroku buildpacks:add --index 1 heroku-community/apt
    

    然后,在你的源目录中创建一个Aptfile,内容如下:

    libpoppler-cpp-dev
    

    然后像往常一样部署。让我知道这是否有帮助!

    【讨论】:

      猜你喜欢
      • 2016-07-27
      • 1970-01-01
      • 1970-01-01
      • 2019-02-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多