./zbarmodule.h:26:10:致命错误:' zbar.h'文件未找到

时间:2016-03-31 05:21:07

标签: python macos zbar

我试图在我的Macbook上安装zbar

当我执行命令pip install zbar时(在brew install zbar之后)抛出异常,如下所示:

Collecting zbar
  Using cached zbar-0.10.tar.bz2
Installing collected packages: zbar
  Running setup.py install for zbar
    building 'zbar' extension
    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c zbarmodule.c -o build/temp.macosx-10.11-intel-2.7/zbarmodule.o
    In file included from zbarmodule.c:24:
    ./zbarmodule.h:26:10: fatal error: 'zbar.h' file not found
    #include <zbar.h>
             ^
    1 error generated.
    error: command 'cc' failed with exit status 1
    Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/var/folders/hx/jbnxkn396zs34xn3fv10tjf40000gn/T/pip-build-PlQauK/zbar/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/hx/jbnxkn396zs34xn3fv10tjf40000gn/T/pip-0yRA4D-record/install-record.txt --single-version-externally-managed --compile:
    running install

    running build

    running build_ext

    building 'zbar' extension

    creating build

    creating build/temp.macosx-10.11-intel-2.7

    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c zbarmodule.c -o build/temp.macosx-10.11-intel-2.7/zbarmodule.o

    In file included from zbarmodule.c:24:

    ./zbarmodule.h:26:10: fatal error: 'zbar.h' file not found

    #include <zbar.h>

             ^

    1 error generated.

    error: command 'cc' failed with exit status 1

    ----------------------------------------
    Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/var/folders/hx/jbnxkn396zs34xn3fv10tjf40000gn/T/pip-build-PlQauK/zbar/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/hx/jbnxkn396zs34xn3fv10tjf40000gn/T/pip-0yRA4D-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /var/folders/hx/jbnxkn396zs34xn3fv10tjf40000gn/T/pip-build-PlQauK/zbar

有一个类似的question,但答案在我的情况下没有帮助。

我还尝试了另一种根据此link

进行安装的方法

但是,当我输入python setup.py install

时发生了同样的错误
running install
running build
running build_ext
building 'zbar' extension
creating build
creating build/temp.macosx-10.11-intel-2.7
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c zbarmodule.c -o build/temp.macosx-10.11-intel-2.7/zbarmodule.o
In file included from zbarmodule.c:24:
./zbarmodule.h:26:10: fatal error: 'zbar.h' file not found
#include <zbar.h>
         ^
1 error generated.
error: command 'cc' failed with exit status 1

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,我运行 conda install zbar,之后,错误消失了。