通过 GCC 的 Win64 Python 扩展

标签 python windows gcc 64-bit mingw

有没有人有幸使用 mingw64 为 Windows 编译 64 位 Python 扩展模块?

我已经使用 VS2008 为该平台成功编译了有问题的扩展。我还使用 mingw32(使用 32 位 python)编译了它。我希望这两个构建都使用 GCC。

我已经使用 Cygwin 安装了 mingw64-x86_64-w64 GCC 4.5.1 工具集,并说服 Python 使用它们。但是,链接到 python 本身失败。

所以我选择了 pexports 0.44,用它转储了一个 python26.def 文件并创建了 libpython26.a

现在,如this question ,我从 Python 得到的唯一链接错误是关于 __imp_py_InitModule4。浏览 def 文件,我看到一个 Py_InitModule4_64 符号。

有什么想法吗?

最佳答案

我发现您需要定义 MS_WIN64 和 WIN32,而且 distutils 包不理解 mingw64,参见 this发布,和this一个

修补 distutils 以支持 mingw64 非常简单。

关于通过 GCC 的 Win64 Python 扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3778370/

相关文章:

python - 使用 pyodbc 在 SQL Server 中创建模式

windows - Tomcat 应用程序未部署

c - 回溯时如何获取文件名和行号?

c++ - [错误]未分配正在释放的指针

c++ - 捕获 lambda 表达式中的非类型模板参数

python - Jupyter notebook 不连接内核(2) - conda + mc os 11.5 + appnope

python - Unix时差显示延迟

python - 为什么 Python 在涉及函数参数的数据类型时不使用 fexlibe?

windows - 如何将多个 Zope 实例安装为 Windows 服务

gcc - CentOS 7 升级了 gcc/g++ 但似乎无法使用?