首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >heroku无法安装zbar

heroku无法安装zbar
EN

Stack Overflow用户
提问于 2013-10-29 04:21:38
回答 2查看 1.4K关注 0票数 2

我有一个使用zbar进行条形码识别的Django应用程序。它在我的开发者机器上运行良好,但当我试图将它部署到Heroku时,我的提交被拒绝了,并显示以下消息:

代码语言:javascript
复制
 Installing collected packages: zbar
         Running setup.py install for zbar
           building 'zbar' extension
           gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/app/.heroku/python/include/python2.7 -c zbarmodule.c -o build/temp.linux-x86_64-2.7/zbarmodule.o
           In file included from zbarmodule.c:24:
           zbarmodule.h:26:18: error: zbar.h: No such file or directory
           In file included from zbarmodule.c:24:
           /*many "undeclared" errors*/
            !     Push rejected, failed to compile Python app

pip install zbar在我的电脑上运行得很好。我填满了requirements.txt

代码语言:javascript
复制
cat requirements.txt
Django==1.5.5
PIL==1.1.7
dj-database-url==0.2.2
dj-static==0.0.5
django-toolbelt==0.0.1
gunicorn==18.0
psycopg2==2.5.1
static==0.4
wsgiref==0.1.2
zbar==0.10

有谁可以帮我?为我的写作错误感到抱歉。英语不是我的母语。

EN

回答 2

Stack Overflow用户

发布于 2017-06-14 18:32:25

zbar python包只是一个包装器。

您需要使用heroku构建包。https://elements.heroku.com/buildpacks/generalui/heroku-buildpack-zbar此构建包将在构建时安装zbar

或者,您也可以使用以下命令:https://elements.heroku.com/buildpacks/heroku/heroku-buildpack-apt

然后将名为Aptfile的文件包含在项目的根目录中

libzbar-dev

它将使用apt-get安装libzbar-dev,因此当pip install zbar运行时,zbar将存在。

编辑:包含apt-get方法

票数 2
EN

Stack Overflow用户

发布于 2020-04-19 00:20:30

请按此方式检查:

  1. Create heroku app
  2. Create next files
    • app.py

from pyzbar.pyzbar import decode

  • Procfile

main: python app.py

  • requirements.txt

pyzbar==0.1.8

  • Aptfile

libzbar-dev

下一个构建包和添加下一个构建包:

  • https://github.com/heroku/heroku-buildpack-apt.git

代码语言:javascript
复制
- `heroku/python`

  1. 在heroku

上推送文件并运行应用程序

来源:https://github.com/NaturalHistoryMuseum/pyzbar/issues/23#issuecomment-615893637

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19644358

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档