2012-02-16 8 views
3

파이썬에서 QR 코드를 인코딩하고 디코딩하는 응용 프로그램을 빌드하려고합니다. 나는 인코더와 함께 성공했지만 파이썬에서 디코딩 할 라이브러리 (그러나 zbar)를 찾지 못했습니다. Windows 7 시스템에서 Python 2.7을 사용하고 있습니다.파이썬 용 QR 코드 디코더 라이브러리

zbar을 설치할 수 없습니다. 라이브러리에 필요한 종속성 모듈을 설치했는데 심지어 설치하려고 할 때마다 많은 오류가 발생합니다. zbar.h 및 zbarmodule.c에 너무 많은 구문 오류가 있습니다. 나는 그 문제가 무엇인지에 대해 왜 우둔한지를 이해하지 못한다. 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 

사람이 zbar 설치를 도와 또는 나에게 내가 QR 코드를 디코딩 할 수있는 라이브러리를받을 수 있습니까?

+1

무엇이 오류입니까? – geoffspear

+1

사람들이 당신이하는 일을 이해할 수 있도록 오류를 지나쳐주십시오. – Nilesh

+0

오류를 포함 시켰습니다. 무엇을 살펴보고 문제가 무엇인지 말해주십시오. 감사합니다 @ 라파다와 우 블레. – vijay

답변

4

pyqrcode은 QR 코드 인코딩 및 디코딩을 지원합니다.

다른 사람이 언급 한 것처럼 zbar와 관련하여 오류 메시지를 알지 못하면서도 도움이되지 않습니다.

Windows 바이너리 패키지 또는 소스에서 zbar를 설치 했습니까?

zbar 그것은 2.5 및 2.6 사용할 수 here위한 파이썬 모듈 바이너리를 가지고, here 사용할 수있는 미리 만들어진 윈도우 바이너리 패키지가있다. 이 zbar Installation Instructions

은 다음과 같습니다 소스에서 zbar 파이썬 모듈을 설치하기 위의 링크를 기반으로 수행해야하는 단계의 요약을 볼 통해 zbar 설치에 대해서는

.

  1. 변수 윈도우 경로에 MinGW
  2. Zbar \ 빈과는 MinGW \ 빈 (바이너리 설치 디렉토리)를 추가 설치
  3. (이진 here 바람직) zbar를 설치 Zbar 파이썬 모듈을 다운로드 source를 here에서 찾아서 임시 폴더에 압축을 풉니 다.
  4. 사용자 정의 zbar 포함 및 라이브러리 경로를 사용하도록 setup.py 스크립트를 수정하십시오. 수정 사용

    library_dirs=["""zbarlibdirectory"""], 
        include_dirs=[get_config_vars('INCLUDEDIR'), 
            get_config_vars('INCLUDEPY'), 
            """zbarincludedirectory"""] 
    
    zbarlibdirectory이 C:\zbar\lib 및 zbarincludedirectory 같은 것입니다

    뭔가

  5. zbar 파이썬 모듈을 설치 C:\zbar\include 같은 :

    3 가 확장 호출에 다음과 같은 매개 변수를 추가 줄을 from distutils.sysconfig import get_config_vars 추가 설정.평

    python setup.py build --compiler=mingw32는 Windows7에 설치 pyqrcode에 관해서는

    python setup.py install

, 정말 아직하지 않은 있지만, 먼저 모든 종속성을 설치, 단지 관련 제목 아래 소스 지침을 믿는다 그런 다음 make를 실행하고 MinGW에서 nmake 또는 make를 사용하여 설치하십시오.

+0

@Appleman에게 감사드립니다. 지금 Windows에 pyqrcode를 어떻게 설치합니까? 그리고 나는 zbar에서 얻은 오류를 포함 시켰고, 소스에서 설치했다. (easy_install을 사용하여 pypi의 [zbar] (http://pypi.python.org/pypi/zbar/0.10) 패키지에서) – vijay