2013-09-30 1 views
1

내 프로젝트에 netifaces 모듈을 사용해야하므로 가져올 수 없습니다.Python netifaces module windows installtion

이 있습니다 ...

error: Unable to find vcvarsall.bat

는 I에 유래에서이 오류에 대한 몇 가지 답변을 읽고,하지만 난 그것을 이해 couldent : 나는 easy_install을 통해 시도 는 소스 코드를 설치하지만 때마다 나는이 메시지가 컴파일 된 버전이나 넷립의 설치 프로그램이 있습니까? 감사합니다.

EDIT 1 : Visual Studio C++를 설치 한 후에이 오류가 발생합니다. 다른 도움이 필요합니까?

Searching for netifaces 
Reading https://pypi.python.org/simple/netifaces/ 
Reading http://alastairs-place.net/netifaces 
Reading http://alastairs-place.net/projects/netifaces 
Best match: netifaces 0.8 
Downloading http://alastairs-place.net/projects/netifaces/netifaces-0.8.tar.gz 
Processing netifaces-0.8.tar.gz 
Writing c:\users\daniel\appdata\local\temp\easy_install-gkcl9j\netifaces-0.8\setup.cfg 
Running netifaces-0.8\setup.py -q bdist_egg --dist-dir c:\users\daniel\appdata\local\temp\easy_install-gkcl9j\netifaces-0.8\egg-dist-tmp-wuxsjm 
netifaces.c 
netifaces.c(406) : error C2275: 'PyObject' : illegal use of this type as an expression 
     c:\python27\include\object.h(108) : see declaration of 'PyObject' 
netifaces.c(406) : error C2065: 'py_family' : undeclared identifier 
netifaces.c(407) : error C2275: 'PyObject' : illegal use of this type as an expression 
     c:\python27\include\object.h(108) : see declaration of 'PyObject' 
netifaces.c(407) : error C2065: 'list' : undeclared identifier 
netifaces.c(407) : error C2065: 'py_family' : undeclared identifier 
netifaces.c(407) : warning C4047: 'function' : 'PyObject *' differs in levels of indirection from 'int' 
netifaces.c(407) : warning C4024: 'PyDict_GetItem' : different types for formal and actual parameter 2 
netifaces.c(409) : error C2065: 'py_family' : undeclared identifier 
netifaces.c(411) : error C2065: 'list' : undeclared identifier 
netifaces.c(411) : warning C4047: '==' : 'int' differs in levels of indirection from 'void *' 
netifaces.c(411) : error C2065: 'list' : undeclared identifier 
netifaces.c(411) : error C2065: 'list' : undeclared identifier 
netifaces.c(411) : error C2065: 'list' : undeclared identifier 
netifaces.c(415) : error C2065: 'list' : undeclared identifier 
netifaces.c(416) : error C2065: 'list' : undeclared identifier 
netifaces.c(416) : warning C4047: '=' : 'int' differs in levels of indirection from 'PyObject *' 
netifaces.c(417) : error C2065: 'list' : undeclared identifier 
netifaces.c(419) : error C2065: 'py_family' : undeclared identifier 
netifaces.c(419) : error C2065: 'py_family' : undeclared identifier 
netifaces.c(419) : error C2065: 'py_family' : undeclared identifier 
netifaces.c(423) : error C2065: 'list' : undeclared identifier 
netifaces.c(424) : error C2065: 'py_family' : undeclared identifier 
netifaces.c(424) : warning C4047: 'function' : 'PyObject *' differs in levels of indirection from 'int' 
netifaces.c(424) : warning C4024: 'PyDict_SetItem' : different types for formal and actual parameter 2 
netifaces.c(424) : error C2065: 'list' : undeclared identifier 
netifaces.c(424) : warning C4047: 'function' : 'PyObject *' differs in levels of indirection from 'int' 
netifaces.c(424) : warning C4024: 'PyDict_SetItem' : different types for formal and actual parameter 3 
netifaces.c(425) : error C2065: 'list' : undeclared identifier 
netifaces.c(425) : error C2065: 'list' : undeclared identifier 
netifaces.c(425) : error C2065: 'list' : undeclared identifier 
netifaces.c(427) : error C2065: 'list' : undeclared identifier 
netifaces.c(427) : warning C4047: 'function' : 'PyObject *' differs in levels of indirection from 'int' 
netifaces.c(427) : warning C4024: 'PyList_Append' : different types for formal and actual parameter 1 
netifaces.c(716) : error C2275: 'PyObject' : illegal use of this type as an expression 
     c:\python27\include\object.h(108) : see declaration of 'PyObject' 
netifaces.c(716) : error C2065: 'dict' : undeclared identifier 
netifaces.c(718) : error C2065: 'dict' : undeclared identifier 
netifaces.c(718) : warning C4047: '=' : 'int' differs in levels of indirection from 'PyObject *' 
netifaces.c(720) : error C2065: 'dict' : undeclared identifier 
netifaces.c(730) : error C2065: 'dict' : undeclared identifier 
netifaces.c(730) : warning C4047: 'function' : 'PyObject *' differs in levels of indirection from 'int' 
netifaces.c(730) : warning C4024: 'PyDict_SetItemString' : different types for formal and actual parameter 1 
netifaces.c(732) : error C2065: 'dict' : undeclared identifier 
netifaces.c(732) : warning C4047: 'function' : 'PyObject *' differs in levels of indirection from 'int' 
netifaces.c(732) : warning C4024: 'PyDict_SetItemString' : different types for formal and actual parameter 1 
netifaces.c(734) : error C2065: 'dict' : undeclared identifier 
netifaces.c(734) : warning C4047: 'function' : 'PyObject *' differs in levels of indirection from 'int' 
netifaces.c(734) : warning C4024: 'PyDict_SetItemString' : different types for formal and actual parameter 1 
netifaces.c(740) : error C2065: 'dict' : undeclared identifier 
netifaces.c(740) : warning C4047: 'function' : 'PyObject *' differs in levels of indirection from 'int' 
netifaces.c(740) : warning C4024: 'add_to_family' : different types for formal and actual parameter 3 
error: Setup script exited with error: command '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe"' failed with exit status 2 
+0

어떤 질문을 읽었으며 ** ** ** 그들로부터 무엇을 이해 했습니까? –

+0

파이썬이 동일한 컴파일러 나 비슷한 것을 사용하기 때문에 비주얼 스튜디오가 필요하다는 것을 알았습니다 ... 아마도 vs80command var을 변경했을 것입니다 ... 나는 정말로 어떤 대답도 찾을 수 없었기 때문에이 질문을 던졌습니다. 감사. –

+0

'easy_install'로 설치하기 전에 Microsoft Visual C++ Express를 설치해야합니다. 파이썬 버전을 빌드 할 때 사용한 것과 동일한 버전의 Visual C++가 필요합니다. –

답변

1

Netifaces는 c99 표준에 따라 작성됩니다. paricular에서 코드는 혼합 된 선언과 코드를 사용합니다. Unfortunatly Microsofts 컴파일러는 해당 표준을 따르지 않으며 혼합 (* .c 파일을 컴파일 할 때)을 이해하지 못합니다. 내 해결책은 단순히 소스 파일의 이름을 'netifaces.cpp'로 바꾸는 것이 었습니다. 그런 식으로 MS 컴파일러는 intermingling 선언과 코드가 허용되는 C++ 빌드를 수행합니다. 이 파일의 이름을 변경하면 'setup.py'를 편집하여 파일 이름을 변경해야합니다.