error: Unable to find vcvarsall.bat

error: Unable to find vcvarsall.bat

Python, Django, MariaDB를 이용하여 간단한 웹 애플리케이션을 만들어 보려고 한다. 그런데 Mysql 연동을 위한 패키지를 설치하면 'vcvarsall.bat' 파일이 없다는 에러가 발생한다. 

 
[root@C:\helloworld]#pip install MySQL-python
Collecting MySQL-python
C:\Python27\lib\site-packages\pip-8.1.2-py2.7.egg\pip\_vendor\requests\packages\urllib3\util\ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS cert
ificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
C:\Python27\lib\site-packages\pip-8.1.2-py2.7.egg\pip\_vendor\requests\packages\urllib3\util\ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer
version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading MySQL-python-1.2.5.zip (108kB)
    100% |################################| 112kB 1.1MB/s
Installing collected packages: MySQL-python
  Running setup.py install for MySQL-python ... error
    Complete output from command C:\Python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\ray\\appdata\\local\\temp\\pip-build-fvz0fq\\MySQL-python\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:
\users\ray\appdata\local\temp\pip-bz89ng-record\install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-2.7
    copying _mysql_exceptions.py -> build\lib.win32-2.7
    creating build\lib.win32-2.7\MySQLdb
    copying MySQLdb\__init__.py -> build\lib.win32-2.7\MySQLdb
    copying MySQLdb\converters.py -> build\lib.win32-2.7\MySQLdb
    copying MySQLdb\connections.py -> build\lib.win32-2.7\MySQLdb
    copying MySQLdb\cursors.py -> build\lib.win32-2.7\MySQLdb
    copying MySQLdb\release.py -> build\lib.win32-2.7\MySQLdb
    copying MySQLdb\times.py -> build\lib.win32-2.7\MySQLdb
    creating build\lib.win32-2.7\MySQLdb\constants
    copying MySQLdb\constants\__init__.py -> build\lib.win32-2.7\MySQLdb\constants
    copying MySQLdb\constants\CR.py -> build\lib.win32-2.7\MySQLdb\constants
    copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-2.7\MySQLdb\constants
    copying MySQLdb\constants\ER.py -> build\lib.win32-2.7\MySQLdb\constants
    copying MySQLdb\constants\FLAG.py -> build\lib.win32-2.7\MySQLdb\constants
    copying MySQLdb\constants\REFRESH.py -> build\lib.win32-2.7\MySQLdb\constants
    copying MySQLdb\constants\CLIENT.py -> build\lib.win32-2.7\MySQLdb\constants
    running build_ext
    building '_mysql' extension
    error: Unable to find vcvarsall.bat
 
    ----------------------------------------
Command "C:\Python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\ray\\appdata\\local\\temp\\pip-build-fvz0fq\\MySQL-python\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\ray\appdata\local
\temp\pip-bz89ng-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\ray\appdata\local\temp\pip-build-fvz0fq\MySQL-python\
 
[root@C:\helloworld]#
 
cs


해결방법

검색해 보니 상위 버전의 Visual Studio를 설치하거나, Python의 내부 파일을 수정하는 방법이 있었다. (참고 1, 2, 3) 다른 방법은 없을지 찾다가 Python 패키지 저장소에서  'MySQL-python' 패키지는 exe 파일도 같이 배포되는 걸 알게 되었다. 'MySQL-python-1.2.5.win32-py2.7.exe'을 다운로드 받아 설치하니 정상 동작한다. 

 
[root@C:\helloworld]#manage.py syncdb
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table django_content_type
Creating table django_session
Creating table django_site
 
You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes
Username (leave blank to use 'ray'): admin
E-mail address: 1@1.com
Password:
Password (again):
Superuser created successfully.
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
 
[root@C:\helloworld]#
 
cs


참고. 설치 환경

- OS : Windows 7 Professional K

- Python : v 2.7.5

- Django : v 1.4

- setuptools : v 1.1

- MariaDB : v 10.1



댓글 쓰기

0 댓글