在Heroku上安装pdftotext库

编程入门 行业动态 更新时间:2024-10-23 23:22:50
本文介绍了在Heroku上安装pdftotext库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

pdftotext库是requirements.txt中的要求.尝试推送到heroku时,出现以下错误:

pdftotext library is a requirement in requirements.txt. While trying to push to heroku, I get the following error:

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上,我没有root访问权限.有解决方案吗?

Normally I'd solve this by installing libpoppler-cpp-dev with apt. But on heroku, I don't have root access to do that. Is there a solution for this?

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

I realize that strictly speaking, this isn't a programming question. But I need this to deploy my program, so I hope the purists here do forgive me.

推荐答案

来自如何安装我的应用程序所需的其他软件包?:

我们不提供安装额外软件包的官方支持,但是有一些不受支持的选项.

We don't offer official support for installing extra packages but there are a couple of unsupported options.

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

One is the experimental heroku-apt-buildpack. You can use this by including any APT package in an Aptfile in your application. The buildpack will then install these packages on the dyno when you deploy your application.

因此,要执行此操作,请首先添加构建包:

So, to do this, first add the build pack:

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

然后,在源目录中创建具有以下内容的Aptfile:

Then, create an Aptfile in your source directory with the following contents:

libpoppler-cpp-dev

并像往常一样部署.让我知道是否有帮助!

And deploy as you normally would. Let me know if that helps!

更多推荐

在Heroku上安装pdftotext库

本文发布于:2023-07-05 09:00:05,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1035484.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Heroku   pdftotext

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!