Question

Je suis en train de construire une application en Python qui encoder et décoder les codes QR. Je réussis avec l'encodeur, mais je ne trouve pas les bibliothèques (mais zbar ) pour le décodage en python. J'utilise Python 2.7 dans un système Windows 7.

Je ne suis pas en mesure d'installer zbar dans mon système. J'ai installé le module de dépendance requis par la bibliothèque et même alors, je me retrouve avec tant d'erreurs, chaque fois que j'essaie de l'installer - tant d'erreurs de syntaxe dans zbar.h et zbarmodule.c. Je ne comprends pas pourquoi et la moindre idée de ce que le problème est.

je reçois les erreurs suivantes lors de l'installation zbar

C:\Users\vijay>easy_install zbar
Searching for zbar
Reading http://pypi.python.org/simple/zbar/
Reading http://zbar.sourceforge.net
Best match: zbar 0.10
Downloading http://pypi.python.org/packages/source/z/zbar/zbar-0.10.zip#md5=9e99
ef2f6b471131120982a0dcacd64b
Processing zbar-0.10.zip
Running zbar-0.10\setup.py -q bdist_egg --dist-dir c:\users\vijay\appdata\local\
temp\easy_install-hv_kag\zbar-0.10\egg-dist-tmp-sxhz3s
zbarmodule.c
C:\Python27\include\zbar.h(685) : error C2054: expected '(' to follow 'inline'
C:\Python27\include\zbar.h(687) : error C2085: 'zbar_processor_parse_config' : n
ot in formal parameter list
C:\Python27\include\zbar.h(687) : error C2143: syntax error : missing ';' before
'{'
C:\Python27\include\zbar.h(761) : error C2054: expected '(' to follow 'inline'
C:\Python27\include\zbar.h(763) : error C2085: 'zbar_processor_error_spew' : not
in formal parameter list
C:\Python27\include\zbar.h(763) : error C2143: syntax error : missing ';' before
'{'
C:\Python27\include\zbar.h(768) : error C2143: syntax error : missing '{' before
'const'
C:\Python27\include\zbar.h(777) : error C2054: expected '(' to follow 'inline'
C:\Python27\include\zbar.h(778) : error C2085: 'zbar_processor_get_error_code' :
not in formal parameter list
C:\Python27\include\zbar.h(778) : error C2143: syntax error : missing ';' before
'{'
C:\Python27\include\zbar.h(882) : error C2054: expected '(' to follow 'inline'
C:\Python27\include\zbar.h(884) : error C2085: 'zbar_video_error_spew' : not in
formal parameter list
C:\Python27\include\zbar.h(884) : error C2143: syntax error : missing ';' before
'{'
C:\Python27\include\zbar.h(889) : error C2143: syntax error : missing '{' before
'const'
C:\Python27\include\zbar.h(897) : error C2054: expected '(' to follow 'inline'
C:\Python27\include\zbar.h(898) : error C2085: 'zbar_video_get_error_code' : not
in formal parameter list
C:\Python27\include\zbar.h(898) : error C2143: syntax error : missing ';' before
'{'
C:\Python27\include\zbar.h(968) : error C2054: expected '(' to follow 'inline'
C:\Python27\include\zbar.h(970) : error C2085: 'zbar_window_error_spew' : not in
formal parameter list
C:\Python27\include\zbar.h(970) : error C2143: syntax error : missing ';' before
'{'
C:\Python27\include\zbar.h(975) : error C2143: syntax error : missing '{' before
'const'
C:\Python27\include\zbar.h(984) : error C2054: expected '(' to follow 'inline'
C:\Python27\include\zbar.h(985) : error C2085: 'zbar_window_get_error_code' : no
t in formal parameter list
C:\Python27\include\zbar.h(985) : error C2143: syntax error : missing ';' before
'{'
C:\Python27\include\zbar.h(1050) : error C2054: expected '(' to follow 'inline'
C:\Python27\include\zbar.h(1052) : error C2085: 'zbar_image_scanner_parse_config
' : not in formal parameter list
C:\Python27\include\zbar.h(1052) : error C2143: syntax error : missing ';' befor
e '{'
C:\Python27\include\zbar.h(1141) : error C2054: expected '(' to follow 'inline'
C:\Python27\include\zbar.h(1143) : error C2085: 'zbar_decoder_parse_config' : no
t in formal parameter list
C:\Python27\include\zbar.h(1143) : error C2143: syntax error : missing ';' befor
e '{'
C:\Python27\include\zbar.h(1276) : error C2054: expected '(' to follow 'inline'
C:\Python27\include\zbar.h(1278) : error C2085: 'zbar_scan_rgb24' : not in forma
l parameter list
C:\Python27\include\zbar.h(1278) : error C2143: syntax error : missing ';' befor
e '{'
zbarmodule.c(65) : error C2143: syntax error : missing ';' before 'type'
zbarmodule.c(66) : error C2065: 'major' : undeclared identifier
zbarmodule.c(66) : error C2065: 'minor' : undeclared identifier
zbarmodule.c(68) : error C2065: 'major' : undeclared identifier
zbarmodule.c(68) : error C2065: 'minor' : undeclared identifier
zbarmodule.c(133) : error C2275: 'zbar_error_t' : illegal use of this type as an
expression
C:\Python27\include\zbar.h(121) : see declaration of 'zbar_error_t'
zbarmodule.c(133) : error C2146: syntax error : missing ';' before identifier 'e
i'
zbarmodule.c(133) : error C2065: 'ei' : undeclared identifier
zbarmodule.c(134) : error C2065: 'ei' : undeclared identifier
zbarmodule.c(134) : error C2065: 'ei' : undeclared identifier
zbarmodule.c(134) : error C2065: 'ei' : undeclared identifier
zbarmodule.c(135) : error C2065: 'ei' : undeclared identifier
zbarmodule.c(135) : error C2065: 'ei' : undeclared identifier
zbarmodule.c(136) : error C2065: 'ei' : undeclared identifier
zbarmodule.c(146) : error C2275: 'PyObject' : illegal use of this type as an exp
ression
    c:\python27\include\object.h(108) : see declaration of 'PyObject'
zbarmodule.c(146) : error C2065: 'mod' : undeclared identifier
zbarmodule.c(147) : error C2065: 'mod' : undeclared identifier
zbarmodule.c(151) : error C2065: 'mod' : undeclared identifier
zbarmodule.c(151) : warning C4047: 'function' : 'PyObject *' differs in levels o
f indirection from 'int'
zbarmodule.c(151) : warning C4024: 'PyModule_AddObject' : different types for fo
rmal and actual parameter 1
zbarmodule.c(152) : error C2065: 'mod' : undeclared identifier
zbarmodule.c(152) : warning C4047: 'function' : 'PyObject *' differs in levels o
f indirection from 'int'
zbarmodule.c(152) : warning C4024: 'PyModule_AddObject' : different types for fo
rmal and actual parameter 1
zbarmodule.c(153) : error C2065: 'mod' : undeclared identifier
zbarmodule.c(153) : warning C4047: 'function' : 'PyObject *' differs in levels o
f indirection from 'int'
zbarmodule.c(153) : warning C4024: 'PyModule_AddObject' : different types for fo
rmal and actual parameter 1
zbarmodule.c(154) : error C2065: 'mod' : undeclared identifier
zbarmodule.c(154) : warning C4047: 'function' : 'PyObject *' differs in levels o
f indirection from 'int'
zbarmodule.c(154) : warning C4024: 'PyModule_AddObject' : different types for fo
rmal and actual parameter 1
zbarmodule.c(155) : error C2065: 'mod' : undeclared identifier
zbarmodule.c(155) : warning C4047: 'function' : 'PyObject *' differs in levels o
f indirection from 'int'
zbarmodule.c(155) : warning C4024: 'PyModule_AddObject' : different types for fo
rmal and actual parameter 1
zbarmodule.c(156) : error C2065: 'mod' : undeclared identifier
zbarmodule.c(156) : warning C4047: 'function' : 'PyObject *' differs in levels o
f indirection from 'int'
zbarmodule.c(156) : warning C4024: 'PyModule_AddObject' : different types for fo
rmal and actual parameter 1
zbarmodule.c(157) : error C2065: 'mod' : undeclared identifier
zbarmodule.c(157) : warning C4047: 'function' : 'PyObject *' differs in levels o
f indirection from 'int'
zbarmodule.c(157) : warning C4024: 'PyModule_AddObject' : different types for fo
rmal and actual parameter 1
zbarmodule.c(158) : error C2065: 'mod' : undeclared identifier
zbarmodule.c(158) : warning C4047: 'function' : 'PyObject *' differs in levels o
f indirection from 'int'
zbarmodule.c(158) : warning C4024: 'PyModule_AddObject' : different types for fo
rmal and actual parameter 1
zbarmodule.c(159) : error C2065: 'mod' : undeclared identifier
zbarmodule.c(159) : warning C4047: 'function' : 'PyObject *' differs in levels o
f indirection from 'int'
zbarmodule.c(159) : warning C4024: 'PyModule_AddObject' : different types for fo
rmal and actual parameter 1
zbarmodule.c(160) : error C2065: 'mod' : undeclared identifier
zbarmodule.c(160) : warning C4047: 'function' : 'PyObject *' differs in levels o
f indirection from 'int'
zbarmodule.c(160) : warning C4024: 'PyModule_AddObject' : different types for fo
rmal and actual parameter 1
zbarmodule.c(162) : error C2065: 'ei' : undeclared identifier
zbarmodule.c(162) : error C2065: 'ei' : undeclared identifier
zbarmodule.c(162) : error C2065: 'ei' : undeclared identifier
zbarmodule.c(163) : error C2065: 'ei' : undeclared identifier
zbarmodule.c(164) : error C2065: 'mod' : undeclared identifier
zbarmodule.c(164) : warning C4047: 'function' : 'PyObject *' differs in levels o
f indirection from 'int'
zbarmodule.c(164) : warning C4024: 'PyModule_AddObject' : different types for fo
rmal and actual parameter 1
zbarmodule.c(164) : error C2065: 'ei' : undeclared identifier
zbarmodule.c(164) : error C2065: 'ei' : undeclared identifier
zbarmodule.c(167) : error C2275: 'PyObject' : illegal use of this type as an exp
ression
    c:\python27\include\object.h(108) : see declaration of 'PyObject'
zbarmodule.c(167) : error C2065: 'dict' : undeclared identifier
zbarmodule.c(167) : error C2065: 'mod' : undeclared identifier
zbarmodule.c(167) : warning C4047: 'function' : 'PyObject *' differs in levels o
f indirection from 'int'
zbarmodule.c(167) : warning C4024: 'PyModule_GetDict' : different types for form
al and actual parameter 1
zbarmodule.c(169) : error C2065: 'dict' : undeclared identifier
zbarmodule.c(169) : warning C4047: 'function' : 'PyObject *' differs in levels o
f indirection from 'int'
zbarmodule.c(169) : warning C4024: 'zbarEnumItem_New' : different types for form
al and actual parameter 1
zbarmodule.c(171) : error C2065: 'dict' : undeclared identifier
zbarmodule.c(171) : warning C4047: 'function' : 'PyObject *' differs in levels o
f indirection from 'int'
zbarmodule.c(171) : warning C4024: 'zbarEnumItem_New' : different types for form
al and actual parameter 1
zbarmodule.c(183) : error C2275: 'PyObject' : illegal use of this type as an exp
ression
        c:\python27\include\object.h(108) : see declaration of 'PyObject'
zbarmodule.c(183) : error C2065: 'tp_dict' : undeclared identifier
zbarmodule.c(185) : error C2065: 'tp_dict' : undeclared identifier
zbarmodule.c(185) : warning C4047: 'function' : 'PyObject *' differs in levels o
f indirection from 'int'
zbarmodule.c(185) : warning C4024: 'zbarEnumItem_New' : different types for form
al and actual parameter 1
zbarmodule.c(186) : error C2065: 'tp_dict' : undeclared identifier
zbarmodule.c(186) : warning C4047: 'function' : 'PyObject *' differs in levels o
f indirection from 'int'
zbarmodule.c(186) : warning C4024: 'zbarEnumItem_New' : different types for form
al and actual parameter 1
zbarmodule.c(187) : error C2065: 'tp_dict' : undeclared identifier
zbarmodule.c(187) : warning C4047: 'function' : 'PyObject *' differs in levels o
f indirection from 'int'
zbarmodule.c(187) : warning C4024: 'zbarEnumItem_New' : different types for form
al and actual parameter 1
zbarmodule.c(188) : error C2065: 'tp_dict' : undeclared identifier
zbarmodule.c(188) : warning C4047: 'function' : 'PyObject *' differs in levels o
f indirection from 'int'
zbarmodule.c(188) : warning C4024: 'zbarEnumItem_New' : different types for form
al and actual parameter 1
zbarmodule.c(189) : error C2065: 'tp_dict' : undeclared identifier
zbarmodule.c(189) : warning C4047: 'function' : 'PyObject *' differs in levels o
f indirection from 'int'
zbarmodule.c(189) : warning C4024: 'zbarEnumItem_New' : different types for form
al and actual parameter 1
zbarmodule.c(190) : error C2065: 'tp_dict' : undeclared identifier
zbarmodule.c(190) : warning C4047: 'function' : 'PyObject *' differs in levels o
f indirection from 'int'
zbarmodule.c(190) : warning C4024: 'zbarEnumItem_New' : different types for form
al and actual parameter 1
zbarmodule.c(191) : error C2065: 'tp_dict' : undeclared identifier
zbarmodule.c(191) : warning C4047: 'function' : 'PyObject *' differs in levels o
f indirection from 'int'
zbarmodule.c(191) : warning C4024: 'zbarEnumItem_New' : different types for form
al and actual parameter 1
zbarmodule.c(192) : error C2065: 'tp_dict' : undeclared identifier
zbarmodule.c(192) : warning C4047: 'function' : 'PyObject *' differs in levels o
f indirection from 'int'
zbarmodule.c(192) : warning C4024: 'zbarEnumItem_New' : different types for form
al and actual parameter 1
zbarmodule.c(193) : error C2065: 'tp_dict' : undeclared identifier
zbarmodule.c(193) : warning C4047: 'function' : 'PyObject *' differs in levels o
f indirection from 'int'
zbarmodule.c(193) : warning C4024: 'zbarEnumItem_New' : different types for form
al and actual parameter 1
zbarmodule.c(194) : error C2065: 'tp_dict' : undeclared identifier
zbarmodule.c(194) : warning C4047: 'function' : 'PyObject *' differs in levels o
f indirection from 'int'
zbarmodule.c(194) : warning C4024: 'zbarEnumItem_New' : different types for form
al and actual parameter 1
zbarmodule.c(195) : error C2065: 'tp_dict' : undeclared identifier
zbarmodule.c(195) : warning C4047: 'function' : 'PyObject *' differs in levels o
f indirection from 'int'
zbarmodule.c(195) : warning C4024: 'zbarEnumItem_New' : different types for form
al and actual parameter 1
zbarmodule.c(196) : error C2065: 'tp_dict' : undeclared identifier
zbarmodule.c(196) : warning C4047: 'function' : 'PyObject *' differs in levels o
f indirection from 'int'
zbarmodule.c(196) : warning C4024: 'zbarEnumItem_New' : different types for form
al and actual parameter 1
zbarmodule.c(197) : error C2065: 'tp_dict' : undeclared identifier
zbarmodule.c(197) : warning C4047: 'function' : 'PyObject *' differs in levels o
f indirection from 'int'
zbarmodule.c(197) : warning C4024: 'zbarEnumItem_New' : different types for form
al and actual parameter 1
error: Setup script exited with error: command '"C:\Program Files (x86)\Microsof
t Visual Studio 9.0\VC\BIN\cl.exe"' failed with exit status 2

Aide Quelqu'un peut-il me l'installation de zbar ou me faire une bibliothèque avec laquelle je peux décoder les codes QR?

Était-ce utile?

La solution

pyqrcode supports codage et le décodage des codes QR.

En ce qui concerne zbar, que d'autres ont fait remarquer, il est difficile de vous aider sans connaître l'un des messages d'erreur.

Avez-vous installé zbar de paquets binaires Windows ou la source?

zbar a un paquet binaire préconstruit de Windows disponible , il possède également binaire pour les modules Python pour 2.5 et 2.6 disponibles .

En ce qui concerne l'installation de zbar par voir ces zbar Instructions d'installation

Un résumé des étapes que vous devez prendre en fonction sur le lien ci-dessus pour installer le module Python zbar à la source est indiquée ci-dessous.

  1. Installer zbar (de préférence à partir du binaire ici )
  2. MinGW
  3. Ajoutez le Zbar de bin et MinGW bin (répertoires d'installation binaires) à votre variable de Windows Path
  4. Télécharger le code source du module Python Zbar de ici et le décompresser dans un dossier temporaire
  5. Modifier le script setup.py à une utilisation personnalisée zbar comprennent et chemin de la bibliothèque.

    Ajouter from distutils.sysconfig import get_config_vars à la ligne 3 et ajouter les paramètres suivants à l'appel d'extension:

        library_dirs=["""zbarlibdirectory"""],
        include_dirs=[get_config_vars('INCLUDEDIR'),
                      get_config_vars('INCLUDEPY'),
                      """zbarincludedirectory"""]
    

    où zbarlibdirectory est quelque chose comme C:\zbar\lib et zbarincludedirectory est quelque chose comme C:\zbar\include

  6. Installer zbar Module python setup.py modifié en utilisant

    python setup.py build --compiler=mingw32

    python setup.py install

En ce qui concerne pyqrcode d'installation sur Windows7, je n'ai pas encore fait, mais vous croyez juste pour les instructions source sous la rubrique concernée, la première installation de toutes les dépendances, puis en cours d'exécution make et make install soit en utilisant nmake ou faire de MinGW.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top