我有一个 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 应用程序
- Create next files
- app.py
from pyzbar.pyzbar import decode
- Procfile
main: python app.py
- 要求.txt
pyzbar==0.1.8
- Aptfile
libzbar-dev
- And add next buildpacks:
-
https://github.com/heroku/heroku-buildpack-apt.git
-
heroku/python
- 在heroku上推送文件并运行应用程序
source: https://github.com/NaturalHistoryMuseum/pyzbar/issues/23#issuecomment-615893637 https://github.com/NaturalHistoryMuseum/pyzbar/issues/23#issuecomment-615893637
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)