Cause:
python3.4 is compiled with msvs2010, so python3.4 can only recognize msvs2010 by default.
python2.7 is compiled with msvs2008, so python2.7 can only recognize msvs2008 by default.
Method One: Install MinGW (not recommended)
Download MinGW environment, add environment variable
or use
python setup.py build –compiler=mingw32
Method Two: install the corresponding version of the MSVs
Python2 Install Msvs2008,python3 installation msvs2010.
Method Three: set the variable
Python2 execution before installing the extension
SET VS90COMNTOOLS = [vcvarsall.bat所在的目录]
Or
SET VS90COMNTOOLS=%VS120COMNTOOLS%
In the lake to smell the Zhang Note: vs120comntools changed to the version of the MSVS you installed corresponding
Python3 execution before installing the extension
SET VS100COMNTOOLS = [vcvarsall.bat所在的目录]
Or
SET VS100COMNTOOLS=%VS120COMNTOOLS%
In the lake to smell the Zhang Note: vs120comntools changed to the version of the MSVS you installed corresponding
Method Four: Modify the installation script
Open it
[python3安装目录]Lib/distutils/msvc9compiler.py
To modify the Msvccompiler function:
vc_env = query_vcvarsall(VERSION, plat_spec)
For:
vc_env = query_vcvarsall(12.0, plat_spec)
In the lake to smell the Zhang Note: 12.0 changed to the MSVs you installed the corresponding version number
Add:
msvs2005 version number 8.0 corresponds to the environment variable Vs80comntools
msvs2008 version number 9.0 corresponds to the environment variable Vs90comntools
msvs2010 version number 10.0 corresponds to the environment variable Vs100comntools
msvs2012 version number 11.0 corresponds to the environment variable Vs110comntools
msvs2013 version number 12.0 corresponds to the environment variable Vs120comntools
Python installation Extension "Unable to find Vcvarsall.bat" workaround