What version of Visual Studio and/or MinGW do I need to build extension modules for a given version of Python?

后端 未结 3 1048
旧时难觅i
旧时难觅i 2020-12-09 12:34

To put this question a different way, what version of Visual C++ was each official build of Python from python.org of Python built with, and what versions of MinGW are compa

相关标签:
3条回答
  • 2020-12-09 13:18

    Presumably, you're talking about a requirement that Python extensions be built to link dynamically with the same C runtime library that the Python instance does. It should first be noted that this depends on how the instance was built, i.e., if you build Python yourself from the source code it is the compiler version you use for the build, not the version of Python, that determines the runtime library being used.

    If you want to know the runtime library versions for the official binary releases, you can work this out yourself using your favorite DLL dependency tool, e.g., Dependency Walker, or by looking to see which runtime library redistributable is contained in the installer.

    Based on my very brief research, I believe you can use the latest version of MinGW with any of these runtime libraries. By default it uses msvcrt.dll, the C runtime built into Windows, but it appears to support using VC++ runtimes instead.

    0 讨论(0)
  • 2020-12-09 13:19

    If anyone is still interested in this in 2020: I've found this (updated) page that lists the Visual C++ compiler versions (and Visual Studio versions that include them) used for each CPython version:

    https://wiki.python.org/moin/WindowsCompilers

    0 讨论(0)
  • 2020-12-09 13:37

    The file PCbuild\readme.txt in the source distribution of each version of Python includes the version of Visual Studio used to make the binaries.

    Python 2.6, 2.7, 3.1, and 3.2 were all compiled with VS 2008. Python 3.3 and 3.4 are compiled with VS 2010.

    I'm not sure about MinGW compatibility.

    If you are looking for command line compilers, Microsoft has released two different SDKs for Windows 7 that include the command line compilers. The first SDK (for .NET 3.5) includes the VS 2008 compilers. The second SDK (for .NET 4.0) includes the VS 2010 compilers.

    Update: The file PCbuild\readme.txt in the source distribution of each version of Python includes the version of Visual Studio used to make the binaries.

    0 讨论(0)
提交回复
热议问题