Building Python C extension modules for Windows

前端 未结 2 1737
再見小時候
再見小時候 2020-12-09 05:33

I have a C extension module and it would be nice to distribute built binaries. Setuptools makes it easy to build extensions modules on OS X and GNU/Linux, since those OSs co

相关标签:
2条回答
  • 2020-12-09 05:47

    Setuptools and distutils don't come with gcc, but they use the same compiler Python was built with. The difference is mostly that on the typical UNIX system that compiler is 'gcc' and you have it installed.

    In order to compile extension modules on Windows, you need a compiler for Windows. MSVS will do, even the Express version I believe, but it does have to be the same MSVC++ version as Python was built with. Or you can use Cygwin or MinGW; See the appropriate section of Installing Python Modules.

    0 讨论(0)
  • 2020-12-09 05:51

    You can use both MinGW and VC++ Express (free, no need to buy it).

    See:

    1. http://eli.thegreenplace.net/2008/06/28/compiling-python-extensions-with-distutils-and-mingw/
    2. http://eli.thegreenplace.net/2008/06/27/creating-python-extension-modules-in-c/
    0 讨论(0)
提交回复
热议问题