python - heroku无法安装zbar

标签 python django heroku zbar

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

 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

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

有人可以帮助我吗? PS 抱歉我的写作错误。英语不是我的母语。

最佳答案

这样检查:

  1. 创建 heroku 应用
  2. 创建下一个文件
    • app.py
      从 pyzbar.pyzbar 导入解码
    • Proc文件
      主要:python app.py
    • 需求.txt
      pyzbar==0.1.8
    • Aptfile
      libzbar-dev
  3. 并添加下一个构建包:
    • https://github.com/heroku/heroku-buildpack-apt.git
    • heroku/python
  4. 在heroku上推送文件并运行应用

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

关于python - heroku无法安装zbar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19644358/

相关文章:

javascript - 将 Rails 应用程序部署到 Heroku 时出现语法错误:ExecJS::RuntimeError: SyntaxError: Unexpected character

reactjs - paypal-checkout 沙箱卡在 heroku 上被拒绝但在本地主机上被接受

Python GTK 文件保存对话框,如何创建 "Close Without Saving"ResponseType

python - 如何在django中启用基本访问认证

python - 是什么导致这个变量在赋值之前引用错误?

python - 重写 get_queryset 会导致 ListView 中的缓存问题,其中数据仍然过时

django - 如何将图像绑定(bind)到 Django 中的编辑表单?

python - 迭代两个数组在字典中查找值

django.db.utils.ProgrammingError : in DJango application

java - 向 Heroku 启动 Dropwizard 项目失败