为 Windows 构建 Python C 扩展模块 [英] Building Python C extension modules for Windows

查看:26
本文介绍了为 Windows 构建 Python C 扩展模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 C 扩展模块,最好分发构建的二进制文件.Setuptools 可以轻松地在 OS X 和 GNU/Linux 上构建扩展模块,因为这些操作系统带有 GCC,但我不知道如何在 Windows 中进行.

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 come with GCC, but I don't know how to do it in Windows.

我需要购买 Visual Studio 的副本,还是 Visual Studio Express 可以工作?我可以只使用 Cygwin 或 MinGW 吗?

Would I need to buy a copy of Visual Studio, or does Visual Studio Express work? Can I just use Cygwin or MinGW?

推荐答案

您可以同时使用 MinGW 和 VC++ Express(免费,无需购买).

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

见:

  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/

这篇关于为 Windows 构建 Python C 扩展模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆