error: Unable to find vcvarsall.bat
Python, Django, MariaDB를 이용하여 간단한 웹 애플리케이션을 만들어 보려고 한다. 그런데 Mysql 연동을 위한 패키지를 설치하면 ‘vcvarsall.bat’ 파일이 없다는 에러가 발생한다.
|
[root@C:helloworld]#pip install MySQL-python
Collecting MySQL-python
C:Python27libsite-packagespip-8.1.2-py2.7.eggpip_vendorrequestspackagesurllib3utilssl_.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:Python27libsite-packagespip-8.1.2-py2.7.eggpip_vendorrequestspackagesurllib3utilssl_.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:Python27python.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(‘rn’, ‘n’), __file__, ‘exec’))” install –record c:
usersrayappdatalocaltemppip-bz89ng-recordinstall-record.txt –single-version-externally-managed –compile:
running install
running build
running build_py
creating build
creating buildlib.win32-2.7
copying _mysql_exceptions.py -> buildlib.win32-2.7
creating buildlib.win32-2.7MySQLdb
copying MySQLdb__init__.py -> buildlib.win32-2.7MySQLdb
copying MySQLdbconverters.py -> buildlib.win32-2.7MySQLdb
copying MySQLdbconnections.py -> buildlib.win32-2.7MySQLdb
copying MySQLdbcursors.py -> buildlib.win32-2.7MySQLdb
copying MySQLdbrelease.py -> buildlib.win32-2.7MySQLdb
copying MySQLdbtimes.py -> buildlib.win32-2.7MySQLdb
creating buildlib.win32-2.7MySQLdbconstants
copying MySQLdbconstants__init__.py -> buildlib.win32-2.7MySQLdbconstants
copying MySQLdbconstantsCR.py -> buildlib.win32-2.7MySQLdbconstants
copying MySQLdbconstantsFIELD_TYPE.py -> buildlib.win32-2.7MySQLdbconstants
copying MySQLdbconstantsER.py -> buildlib.win32-2.7MySQLdbconstants
copying MySQLdbconstantsFLAG.py -> buildlib.win32-2.7MySQLdbconstants
copying MySQLdbconstantsREFRESH.py -> buildlib.win32-2.7MySQLdbconstants
copying MySQLdbconstantsCLIENT.py -> buildlib.win32-2.7MySQLdbconstants
running build_ext
building ‘_mysql’ extension
error: Unable to find vcvarsall.bat
—————————————-
Command “C:Python27python.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(‘rn’, ‘n’), __file__, ‘exec’))” install –record c:usersrayappdatalocal
temppip-bz89ng-recordinstall-record.txt –single-version-externally-managed –compile” failed with error code 1 in c:usersrayappdatalocaltemppip-build-fvz0fqMySQL-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