【问题标题】:How to compile cython module for multiple platforms on windows?如何在 Windows 上为多个平台编译 cython 模块?
【发布时间】:2017-02-08 04:04:14
【问题描述】:

有没有办法为多个平台编译指定的 cython 文件?如果有,该怎么做?

我需要一个工具为 linux 和 windows 编译模块(如果这也可以编译到其他流行的平台也很好)。

这是 distutils 的设置?

【问题讨论】:

    标签: python compilation cross-platform cross-compiling cython


    【解决方案1】:

    我不确定它是否会完全回答您的问题,但如果您想将 python 包(包含 c/cython 代码)分发到各种平台,您可以使用一些持续集成服务在特定平台上构建 wheels 和然后分发它们。

    例如,您可以使用Travis CI(适用于 Linux 和 OS X)和Appveyor(适用于 Windows)来构建您的项目(在一组选定的 python 版本上),然后将创建的轮子与您的代码一起更新打包到 PyPI。

    之后,执行pip install your_package 的用户将获取您项目的轮子,从而避免编译。

    Python documentation about wheels
    Python documentation about supporting windows thanks to appveyor

    【讨论】:

      猜你喜欢
      • 2015-02-13
      • 2018-08-23
      • 2016-08-17
      • 1970-01-01
      • 2010-11-11
      • 2015-05-30
      • 2016-04-02
      • 2017-11-09
      • 1970-01-01
      相关资源
      最近更新 更多