我有一个 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 抱歉我的写作错误。英语不是我的母语。
最佳答案
这样检查:
- 创建 heroku 应用
- 创建下一个文件
- app.py
从 pyzbar.pyzbar 导入解码
- Proc文件
主要:python app.py
- 需求.txt
pyzbar==0.1.8
- Aptfile
libzbar-dev
- app.py
- 并添加下一个构建包:
https://github.com/heroku/heroku-buildpack-apt.git
heroku/python
- 在heroku上推送文件并运行应用
来源:https://github.com/NaturalHistoryMuseum/pyzbar/issues/23#issuecomment-615893637
关于python - heroku无法安装zbar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19644358/