1

我正在尝试使用 Python 2.6.6 安装 Zbar,但出现很多错误,我试图删除它们但仍然留下一个,

当我尝试使用我的 cmd 安装 zbar 时出现错误:

  C:\zbar>python setup.py install
running install
running build
running build_ext
building 'zbar' extension
error: Unable to find vcvarsall.bat

(我的 c 驱动器中有zbar文件夹)不明白这在页面中是什么意思“Windows 用户请注意:除非 ZBar 库 DLL(当前为libzbar -0.dll)在您的Windows 系统路径!” 所以我保持原样。在环境变量路径中,我只添加了这些(可以吗?)

;C:\Python26;C:\MinGW\bin

然后我在安装后下载了MinGW(选择了MinGW基础工具,g++编译器和MinGW make)然后我得到了错误

 error:unrecognized command line option ‘-mno-cygwin’
error: command ‘gcc’ failed with exit status 1

然后我检查了 gcc --version 它是 4.8.1 并在 Libs/disutils/cygwincompiler.py 文件中进行了更改:

    self.set_executables(compiler='gcc -mno-cygwin -O -Wall',
                         compiler_so='gcc -mno-cygwin -mdll -O -Wall',
                         compiler_cxx='g++ -mno-cygwin -O -Wall',
                         linker_exe='gcc -mno-cygwin',
                         linker_so='%s -mno-cygwin %s %s'
                                    % (self.linker_dll, shared_option,
                                       entry_point))

取而代之

self.set_executables(compiler='gcc -O -Wall',
                         compiler_so='gcc -mdll -O -Wall',
                         compiler_cxx='g++ -O -Wall',
                         linker_exe='gcc',
                         linker_so='%s %s %s'
                                    % (self.linker_dll, shared_option,
                                       entry_point))

现在,当我尝试再次构建时,出现此错误?

C:\zbar>setup.py install build --compiler=mingw32
running install
running build
running build_ext
building 'zbar' extension
C:\MinGW\bin\gcc.exe -mdll -O -Wall -IC:\Python26\include -IC:\Python26\PC -c zb
armodule.c -o build\temp.win32-2.6\Release\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 'gcc' failed with exit status 1

C:\zbar>

我应该如何克服这个错误任何人请帮助我安装 Zbar。 还需要知道我是否应该使用 Python 2.7 或 2.6 以便更好地使用它。

4

1 回答 1

1
  1. 从http://sourceforge.net/projects/zbar/files/zbar/0.10/zbar-0.10-setup.exe/download安装“ZBar 条形码阅读器”,包括开发者标题(在安装过程中选择)。
  2. 从https://pypi.python.org/packages/2.6/z/zbar/zbar-0.10.win32-py2.6.exe#md5=820f4abfdae56997f1fc84b6fd1101fb安装 Python 2.6 的预编译 zbar 库。
  3. libzbar-0.dll位于的添加c:\Program Files\ZBar\bin\libzbar-0.dll到您的 PATH。您还可以按照此答案Python26, Win32, ZBar - ImportError: DLL load failed without modifying your PATH中的描述使其工作。
于 2013-12-05T12:19:57.810 回答