【问题标题】:python distutils C++ compilationpython distutils C++ 编译
【发布时间】:2012-01-13 08:43:59
【问题描述】:

我正在尝试为 android 构建一个 python 模块。

虽然我可以使用export CC= 设置编译器,但我无法为使用export CXX= 的C++ 编译器设置相同的编译器。它仍然使用基本的 C 编译器。

谁能帮我弄清楚如何在构建 python 模块时配置编译器?

谢谢。

【问题讨论】:

  • 您能否提供其他详细信息,例如文件命名等?关于编写setup.py 的文档说(正如我所料)如果您使用.cc.cpp(我猜也是.C)作为扩展名,则应该识别C++ 文件
  • 这很奇怪,因为内部函数 distutils.sysconfig.customize_compiler 确实会查看 CXX。你能在你的环境中设置 DISTUTILS_DEBUG 并粘贴“python setup.py -vv build”的输出吗?

标签: python compiler-construction distutils toolchain


【解决方案1】:

这里有一些旧的关于如何更改编译器的 Windows 说明

    Create a file called 'distutils.cfg' in "C:\Python26\Lib\distutils".
    Open it with a text editor ('notepad distutils.cfg') and fill in the following lines:

    [build]
    compiler=mingw32

当您设法找到 distutils 文件夹时,其他平台也应该如此。

但是 setup.py / Python 包可以做自己的事情,这些必须逐案解决。

【讨论】:

  • Android 的交叉编译也有很多自己的问题 :( 我建议你尝试在 Android 特定的上下文中查阅这个。
猜你喜欢
  • 2012-04-19
  • 2014-11-14
  • 2011-12-22
  • 2011-03-13
  • 1970-01-01
  • 2023-03-29
  • 2013-04-11
  • 1970-01-01
  • 2011-02-14
相关资源
最近更新 更多