我有一个使用 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 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对不起我的写作错误。英语不是我的母语。
请您参考如下方法:
这样检查:
- 创建 heroku 应用
- 创建下一个文件
- 应用程序.py
从 pyzbar.pyzbar 导入解码 - 简介
main: python app.py - 要求.txt
pyzbar==0.1.8 - 应用文件
libzbar-dev
- 应用程序.py
- 并添加下一个构建包:
https://github.com/heroku/heroku-buildpack-apt.githeroku/python
- 在 heroku 上推送文件并运行应用
来源:https://github.com/NaturalHistoryMuseum/pyzbar/issues/23#issuecomment-615893637
