Error-Unable to find vcvarsall.bat

CODEDRAGON Development/Python

반응형

   

   

에러 메시지

C:\Users\yuriyuri\git\study_Python\studyPython\ch11-C>python setup.py install

running install

running build

running build_ext

building 'text' extension

error: Unable to find vcvarsall.bat

  

python build version과 현재 설치되어 있는 compiler version이 달라서 발생

   

   

   

해결방법1

MinGW 다운로드 및 설치하기

http://codedragon.tistory.com/671

   

   

자동 빌드를 위해 distutils.cfg파일 수정

기본값은 distutils.cfg파일이 존재하지 않음로 새 파일을 생성하여 distutils.cfg로 저장합니다

   

C:\Pythonxx\Lib\distutils\distutils.cfg 파일생성하기

[build]

compiler=mingw32

   

 

파이션 내장 모듈중 하나인 Distutils을 통해 빌드

python setup.py install

C:\Users\codedragon\git\study_Python\studyPython\ch11-C>python setup.py install

running install

running build

running build_ext

building 'text' extension

C:\MinGW\bin\gcc.exe -mdll -O -Wall -IC:\Python34\include -IC:\Python34\include

-c textmodule.c -o build\temp.win32-3.4\Release\textmodule.o

textmodule.c:29:13: error: 'text_strlen' undeclared here (not in a function)

{"strlen", text_strlen, METH_VARARGS,"count a string length."},

^

textmodule.c:9:1: warning: 'spam_strlen' defined but not used [-Wunused-function

]

spam_strlen(PyObject *self, PyObject *args){

^

error: command 'C:\\MinGW\\bin\\gcc.exe' failed with exit status 1

   

C:\Users\codedragon\git\study_Python\studyPython\ch11-C>python setup.py install

running install

running build

running build_ext

building 'text' extension

C:\MinGW\bin\gcc.exe -mdll -O -Wall -IC:\Python34\include -IC:\Python34\include

-c textmodule.c -o build\temp.win32-3.4\Release\textmodule.o

writing build\temp.win32-3.4\Release\text.def

creating build\lib.win32-3.4

C:\MinGW\bin\gcc.exe -shared -s build\temp.win32-3.4\Release\textmodule.o build\

temp.win32-3.4\Release\text.def -LC:\Python34\libs -LC:\Python34\PCbuild -lpytho

n34 -lmsvcr100 -o build\lib.win32-3.4\text.pyd

running install_lib

copying build\lib.win32-3.4\text.pyd -> C:\Python34\Lib\site-packages

running install_egg_info

Writing C:\Python34\Lib\site-packages\text-1.0-py3.4.egg-info

   

C:\Users\codedragon\git\study_Python\studyPython\ch11-C>

   

또는

cfg파일 수정없이 빌드 옵션으로 빌드하기

setup.py install build --compiler=mingw32

   

   

   

   

해결방법1로 해결되었으나 아래의 해결방법으로도 해결된 경우가 있으므로 참조

   

   

해결방법2

Visual Studio 2010 설치된 경우

SET VS90COMNTOOLS=%VS100COMNTOOLS%

python setup.py install

   

Visual Studio 2012 (Visual Studio Version 11) 설치된 경우

SET VS90COMNTOOLS=%VS110COMNTOOLS%

python setup.py install

   

Visual Studio 2013 (Visual Studio Version 12) 설치된 경우

SET VS90COMNTOOLS=%VS120COMNTOOLS%

python setup.py install

   

   

   

   

출처: <http://ultrainfinitum.blogspot.kr/2012/12/python-error-unable-to-find-vcvarsallbat.html>

반응형