我有一个使用zbar进行条形码识别的Django应用程序。它在我的开发者机器上运行良好,但当我试图将它部署到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 apppip 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有谁可以帮我?为我的写作错误感到抱歉。英语不是我的母语。
发布于 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方法
发布于 2020-04-19 00:20:30
请按此方式检查:
from pyzbar.pyzbar import decode
main: python app.py
pyzbar==0.1.8
libzbar-dev
下一个构建包和添加下一个构建包:
https://github.com/heroku/heroku-buildpack-apt.git- `heroku/python`
上推送文件并运行应用程序
来源:https://github.com/NaturalHistoryMuseum/pyzbar/issues/23#issuecomment-615893637
https://stackoverflow.com/questions/19644358
复制相似问题