我有一个网站托管在Heroku http://heroku.com/,我现在想使用python-qrtools
包使用了ZBar条码扫描器 http://zbar.sourceforge.net/。在常规的 debian(基于)上,我可以做一个简单的操作:
sudo apt-get install python-qrtools
根据命令dpkg-query -L python-qrtools
,这将安装以下内容:
/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
当我查看进口产品时qrtools.py
,它还做了一个import zbar
,(据我所知)Zbar 包的 python 绑定(Pypi 链接在这里 https://pypi.python.org/pypi/zbar)。我有点惊讶 zbar 或其 python 绑定不在列表中python-qrtools
不过 apt 包。所以我的第一个问题是:
这个 zbar 软件包是何时何地安装的?
接下来,我决定在 Heroku 上安装 ZBar 及其 python 绑定。我设法使用安装 ZBar这个 ZBar 构建包 https://github.com/ballantyne/heroku-buildpack-zbar所以我只需要安装 zbar Python 绑定。从 python 命令行我已经看到它是源自 .so 文件的绑定:
>>> import zbar
>>> zbar.__file__
'/usr/lib/python2.7/dist-packages/zbar.so'
所以我做了一个简单的sudo pip install zbar
,不幸的是,这导致了我粘贴在下面的巨大编译错误。所以我的主要问题实际上是:
如何单独安装 zbar python 绑定(因此无需 apt)?欢迎所有提示!
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
所以我尝试使用单独安装Python zbar绑定
不幸的是我什至似乎无法在 Linux 上安装 zbar 包