heroku cannot install zbar

安稳与你 提交于 2019-12-08 02:14:18

问题


I have a Django application which uses zbar for barcode recognition. It works fine on my developer machine but when i tried to deploy it to Heroku my commit was rejected with the following message:

 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 works fine on my computer. And i filled 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

Can anyone help me? PS Sorry for my writing mistakes. English in not my native language.


回答1:


the zbar python package is just a wrapper.

You need to use heroku buildpacks. https://elements.heroku.com/buildpacks/generalui/heroku-buildpack-zbar this buildpack will install zbar on build

alternatively, you can also use this: https://elements.heroku.com/buildpacks/heroku/heroku-buildpack-apt

and then include file called Aptfile in the root of your project

libzbar-dev

it will install libzbar-dev using apt-get so when pip install zbar runs, zbar will exist.

edit: include apt-get method



来源:https://stackoverflow.com/questions/19644358/heroku-cannot-install-zbar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!