2013-10-28 137 views
1

我有一個Django應用程序使用zbar進行條形碼識別。 它的工作原理我的開發機器上很好,但是當我試圖將其部署到Heroku的我提交與下面的郵件被拒絕:heroku無法安裝zbar

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抱歉我寫錯了。英語不是我的母語。

+0

我從來沒有用過的Heroku,但您使用的virtualenv?您可能沒有權限編譯全球網站包的東西。編輯:你有'建立必要的'安裝? – Enrico

+0

@Enrico是的,我使用virtualenv。 「我的開發人員機器上安裝了必要的」嗎? –

回答

1

zbar python包只是一個包裝。

您需要使用heroku buildpack。 https://elements.heroku.com/buildpacks/generalui/heroku-buildpack-zbar 這buildpack將在構建安裝zbar和

另外,您還可以使用此: https://elements.heroku.com/buildpacks/heroku/heroku-buildpack-apt

,然後包括文件在你的項目的根稱爲Aptfile

libzbar-dev

它將使用apt-get安裝libzbar-dev,因此當pip install zbar運行時,zbar將存在。

編輯:包括apt-get的方法