I am using python 2.7.2 installed via the pre-built installer package, and my SDK version is v7.1. 1) The MSSdk environment variable is not set by lastest SDK's SetEnv.cmd anymore, but distutils still check for it. 2) I have also install MSVC 2010 Express Edition, and its vcvarsall.bat can't be found. Off-side question: a) Can i use different version of MSVC from which python is built for extension development ? b) Can i use mingw compiler to develop extension for the pre-built windows binary python ?
> 1) The MSSdk environment variable is not set by lastest SDK's > SetEnv.cmd anymore, but distutils still check for it. This is intentional. Older SDKs still set the variable, so there is nothing wrong with checking it. > 2) I have also install MSVC 2010 Express Edition, and its > vcvarsall.bat can't be found. MSVC 2010 is not supported for building Python 2.7 extension modules. > a) Can i use different version of MSVC from which python is built for > extension development ? No. Because of the way the MSVCRT works, this can cause crashes. > b) Can i use mingw compiler to develop extension for the pre-built > windows binary python ? Yes, in principle. In practice, it may fail because of gcc limitations.
Thanks for your replying. Here is my understanding of how the compiler chosen logic works, correct me if i am wrong: 1) If using MSVC, we should ALWAYS stick the compiler to the version which python was compiled with; 2) But we can change SDK version through DISTUTILS_USE_SDK with SetEnv.cmd already called. 3) It's the compiler version that matters, not SDK version. But from distutils source: if "DISTUTILS_USE_SDK" in os.environ and "MSSdk" in os.environ and ...: ^^^^^ does this mean i can not use lastest SDK since it does not set MSSdk variable?
DISTUTILS_USE_SDK really means "shut up, I know what I'm doing". So if this is the case (i.e. you *really* know what you are doing), just set MsSdk as well. I don't actually know whether the latest SDK is able to build correct extensions for Python 2.7 - I haven't looked at the latest SDK. It may be that MS stopped setting MsSdk for a reason.