Raspberry Pi3 中 zbar 的构建轮失败

问题描述

我想使用 OpenCV 和相机模块来识别带有 RaspBerry Pi3 的二维码

我按照文章here进行操作,直到运行“from pyzbar import pyzbar”之前,一切都很好。 它显示以下文本:

    Traceback (most recent call last):
  File "<stdin>",line 1,in <module>
ImportError: No module named pyzbar

我一直在为此寻找解决方案,并按照以下说明进行操作:

sudo apt-get install python-qrtools
sudo apt-get install libzbar-dev
sudo pip install zbar

但是当我运行“sudo pip install zbar”时,它显示

Looking in indexes: https://pypi.org/simple,https://www.piwheels.org/simple
Collecting zbar
  Using cached https://files.pythonhosted.org/packages/33/54/cc5819efc9ee7e34b60b41e1d2d4753b6dd0c26a41c9a552611f66aa106e/zbar-0.10.tar.bz2
Building wheels for collected packages: zbar
  Running setup.py bdist_wheel for zbar ... error
  Complete output from command /usr/bin/python -u -c "import setuptools,tokenize;__file__='/tmp/pip-install-2m99GE/zbar/setup.py';f=getattr(tokenize,'open',open)(__file__);code=f.read().replace('\r\n','\n');f.close();exec(compile(code,__file__,'exec'))" bdist_wheel -d /tmp/pip-wheel-THRXHm --python-tag cp27:
  running bdist_wheel
  running build
  running build_ext
  building 'zbar' extension
  creating build
  creating build/temp.linux-armv7l-2.7
  arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-InigCj/python2.7-2.7.16=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c zbarmodule.c -o build/temp.linux-armv7l-2.7/zbarmodule.o
  zbarmodule.c: In function ‘version’:
  zbarmodule.c:66:5: error: too few arguments to function ‘zbar_version’
       zbar_version(&major,&minor);
       ^~~~~~~~~~~~
  In file included from zbarmodule.h:26,from zbarmodule.c:24:
  /usr/include/zbar.h:269:12: note: declared here
   extern int zbar_version(unsigned *major,^~~~~~~~~~~~
  error: command 'arm-linux-gnueabihf-gcc' Failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for zbar
  Running setup.py clean for zbar
Failed to build zbar
Installing collected packages: zbar
  Running setup.py install for zbar ... error
    Complete output from command /usr/bin/python -u -c "import setuptools,'exec'))" install --record /tmp/pip-record-ADZ1pW/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_ext
    building 'zbar' extension
    creating build
    creating build/temp.linux-armv7l-2.7
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-InigCj/python2.7-2.7.16=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c zbarmodule.c -o build/temp.linux-armv7l-2.7/zbarmodule.o
    zbarmodule.c: In function ‘version’:
    zbarmodule.c:66:5: error: too few arguments to function ‘zbar_version’
         zbar_version(&major,&minor);
         ^~~~~~~~~~~~
    In file included from zbarmodule.h:26,from zbarmodule.c:24:
    /usr/include/zbar.h:269:12: note: declared here
     extern int zbar_version(unsigned *major,^~~~~~~~~~~~
    error: command 'arm-linux-gnueabihf-gcc' Failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools,'exec'))" install --record /tmp/pip-record-ADZ1pW/install-record.txt --single-version-externally-managed --compile" Failed with error code 1 in /tmp/pip-install-2m99GE/zbar/

我认为错误Failed building wheel for zbar”将是它的关键,我运行以下说明:

sudo apt install python-zbar
sudo apt install zbar-tools

运行后,当我运行“sudo pip install zbar”时,它仍然显示相同的错误。仍然没有名为 pyzbar 的模块。有人知道问题出在哪里吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...