Under Windows, the official recommendation is to compile the extension with the same Visual Studio version as the one that compiled Python itself, and now the more commonly used versions of Python correspond to the following Visual Studio:
Python 2.7-visual Studio 2008 (9)
Python 3.3 & 3.4-visual Studio 2010 (10)
Python 3.5-visual Studio 2015 (14)
Recently installed a Python 3.5, need to compile fast r-cnn python extension module, the computer installed Visusal Studio version only 2013, and compiled fast R-CNN and its dependencies required Cuda Toolkit currently does not support visual Studio 2015. Run the Python setup.py build directly with an error indicating that the Vcvarsall.bat was not found.
Workaround:
To edit the Python installation directory/lib/distutils/_msvccompiler.py, search for this line:
If version >= and version > best_version:
Here 14 is the minimum version (i.e. 2015) of Visual Studio installed in the Distutils automatic search system, modified to 12 (i.e. 2013), save, run the Python setup.py build again, successfully start compiling, and finally error in the link stage, Tip The library file could not be found Ucrt.lib
This ucrt.lib is the product of Visual C + + 2015 for the C language runtime, corresponding to the previous version of Visual C + + MSVCRT.lib, the solution is very simple, open the VC installation directory/lib, Locate MSVCRT.lib, copy one and rename it to Ucrt.lib, run Python setup.py build again, and compile successfully.
This article is from the "wdx04" blog, make sure to keep this source http://wdx04.blog.51cto.com/288327/1766199
Build under Windows Cross-VC version. PYD extension (extension) module