How to set Python bindings from apt package?

I have a site hosted in Heroku and now I want to use the python-qrtools package that uses the ZBar barcode scanner . On regular debian (based), I can do simple:

 sudo apt-get install python-qrtools 

According to the dpkg-query -L python-qrtools this sets up the following:

 /usr/lib/python2.7/dist-packages/qrtools-1.2.egg-info /usr/lib/python2.7/dist-packages/qrtools.py /usr/share/doc/python-qrtools/copyright /usr/share/doc/python-qrtools/changelog.Debian.gz 

When I look at qrtools.py import, it also does import zbar , which (as I understand it) is python binding for the Zbar package ( Pypi link here ). I am very surprised that zbar or its python bindings are not on the list with the python-qrtools apt package. So my first question is:

When and where is this zbar package installed?

Moving on, I decided to install ZBar and the python binding for it on Heroku. I was able to install ZBar using this ZBar buildpack , so I only need to set the binding to Zbar Python. From the python command line, I can already see that this is a binding coming from a .so file:

 >>> import zbar >>> zbar.__file__ '/usr/lib/python2.7/dist-packages/zbar.so' 

So, I made a simple sudo pip install zbar , which, unfortunately, leads to a massive compilation error, which I inserted below. So my main question is this:

How to set python zbar bindings separately (so without apt)? All tips are welcome!

 Downloading/unpacking zbar Downloading zbar-0.10.tar.bz2 Running setup.py (path:/tmp/pip_build_root/zbar/setup.py) egg_info for package zbar Installing collected packages: zbar Running setup.py install for zbar building 'zbar' extension x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c zbarmodule.c -o build/temp.linux-x86_64-2.7/zbarmodule.o In file included from zbarmodule.c:24:0: zbarmodule.h:26:18: fatal error: zbar.h: No such file or directory #include <zbar.h> ^ compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/zbar/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-zIuGzw-record/install-record.txt --single-version-externally-managed --compile: running install running build running build_ext building 'zbar' extension creating build creating build/temp.linux-x86_64-2.7 x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c zbarmodule.c -o build/temp.linux-x86_64-2.7/zbarmodule.o In file included from zbarmodule.c:24:0: zbarmodule.h:26:18: fatal error: zbar.h: No such file or directory #include <zbar.h> ^ compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 

So, I tried to set the Python zbar binding separately using

Unfortunately, I can't even install the zbar package on linux

+7
python linux debian apt zbar
Dec 10 '14 at 16:57
source share
1 answer
 sudo apt-get install libzbar-dev sudo pip install zbar 

Typically, this is the -dev package, which you skip when you receive such errors, an easy way to find the apt-cache search package, as shown below:

 ~$ apt-cache search zbar libbarcode-zbar-perl - bar code scanner and decoder (Perl bindings) libzbar-dev - bar code scanner and decoder (development) libzbar0 - bar code scanner and decoder (library) libzbargtk-dev - bar code scanner and decoder (GTK+ bindings development) libzbargtk0 - bar code scanner and decoder (GTK+ bindings) libzbarqt-dev - bar code scanner and decoder (Qt bindings development) libzbarqt0 - bar code scanner and decoder (Qt bindings) python-qrtools - high level library for reading and generating QR codes python-zbar - bar code scanner and decoder (Python bindings) python-zbarpygtk - bar code scanner and decoder (PyGTK bindings) zbar-dbg - bar code scanner and decoder (debug) zbar-tools - bar code scanner and decoder (utilities) 

FWIW, the procedure I used to install was python-qrtools , libzbar-dev and finally pip install zbar .

+8
Dec 10 '14 at 17:18
source share



All Articles