Installing Zbar in Windows for Python 2.6.6

3.5k views Asked by At

I am trying to install Zbar with Python 2.6.6 but getting a lot of error's i tried to remove them but still left with one,

When i tried to install zbar with my cmd i got error:

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

(I have the zbar folder in my c drive) did'nt understood what does this means in this page "Windows users please note: the module will NOT load unless the ZBar library DLL (currently libzbar-0.dll) is available in your Windows system PATH!" so i left it as it is. In Environment Variables Path i have added only these (is it ok ?)

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

Then i downloaded MinGW (selected the MinGW base tools, g++ compiler and MinGW make) after i installed it then i got error

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

Then i checked the gcc --version it's 4.8.1 and i made changes in Libs/disutils/cygwincompiler.py file :

    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))

Relaced with

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))

Now when i tried to build again i get this error ?

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>

How should i get over with this error any one please help i need to install Zbar. Also Need to know if i should use Python 2.7 or 2.6 for better use of this.

1

There are 1 answers

1
Fenikso On BEST ANSWER
  1. Install "ZBar bar code reader" from http://sourceforge.net/projects/zbar/files/zbar/0.10/zbar-0.10-setup.exe/download including developer headers (choose during setup).
  2. Install precompiled zbar library for Python 2.6 from https://pypi.python.org/packages/2.6/z/zbar/zbar-0.10.win32-py2.6.exe#md5=820f4abfdae56997f1fc84b6fd1101fb .
  3. Add libzbar-0.dll located at c:\Program Files\ZBar\bin\libzbar-0.dll to your PATH. You can also make it work as described in this answer Python26, Win32, ZBar - ImportError: DLL load failed without modifying your PATH.