如何为不同的OS/版本的Python编译Python C/C ++扩展? [英] How do you compile Python C/C++ extensions for different OS/versions of Python?

查看:58
本文介绍了如何为不同的OS/版本的Python编译Python C/C ++扩展?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到一些成熟的Python库已经针对大多数体系结构(Win32/Win-amd64/MacOS)和Python版本进行了预编译.在不同环境下交叉编译扩展的标准方法是什么?葡萄酒?虚拟机?众包?

I have noticed that several mature Python libraries have precompiled versions for most architectures (Win32/Win-amd64/MacOS) and versions of Python. What is the standard way to cross-compile your extensions for different environments? Wine? Virtual machines? Crowd sourcing?

推荐答案

我们使用虚拟机和 Hudson 服务器.

We use Virtual Machines and a Hudson server.

对于每种支持的架构,我们都有一个虚拟机(通常编译不会扩展分配给它们的资源,因此VM很好).我猜每个虚拟机的配置都可以由Puppet或Chef来管理,以确保它是合适的构建环境.如果您拥有硬件,当然可以使用真实的机器,但是您要避免使用人们实际使用的机器(例如开发人员工作站).

We have a Virtual Machine for each architecture we support (generally compiling doesn't stretch the resources allocated to them, so a VM is fine). I guess the configuration of each VM could be managed by something like Puppet or Chef to ensure it is a suitable build environment. You could of course use real machines if you have the hardware, but you'd want to avoid using machines which people are actually using (e.g. developer workstations).

然后,我们在哈德森使用一个多配置项目来设置构建矩阵.构建矩阵允许我们(单击一下)在多种体系结构上构建多个python版本,但是从理论上讲,您可以构建可以在矩阵中设置的所有组合.当然,您可以使用詹金斯代替.

We then use a multi-configuration project in Hudson to setup a build matrix. The build matrix allows us to (with a single click) build multiple python versions, on multiple architectures, but in theory you can build every and any combination you can setup in your matrix. Of course you could use Jenkins instead.

这篇关于如何为不同的OS/版本的Python编译Python C/C ++扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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