简体   繁体   English

Boost.python与Cython for C ++ / python接口

[英]Boost.python vs Cython for C++/python interface

I know this has been asked a thousand times, however i need to choose a library that can expose C++ functions and methods to python. 我知道这已被问了一千次,但是我需要选择一个可以将C ++函数和方法暴露给python的库。

Considering my application, which mainly is a scientific (matrix) library, and python generator's matureness, support availability and performance, i have come across two options: 考虑到我的应用程序,主要是科学(矩阵)库,以及python生成器的成熟度,支持可用性和性能,我遇到了两个选项:

  • Cython 用Cython
  • Boost.Python Boost.Python的

I have eliminated (for good or bad reasons) others options like SWIG, SIP, Pybindgen, ... 我已经消除了(出于好的或坏的原因)其他选项,如SWIG,SIP,Pybindgen,......

Any advice regarding those 2 library ? 关于那2个图书馆的任何建议? Any of these which would have a killer feature ? 任何具有杀手功能的东西?

My project has namespaces, nested classes, callbacks, and the like. 我的项目有名称空间,嵌套类,回调等。

Thanks 谢谢

Considering my application, which mainly is a scientific 考虑到我的应用,主要是科学的

That pretty much means Cython. 这几乎意味着Cython。 Cython was made almost specifically for that very purpose. Cython几乎专门用于此目的。 There is a video on getting started with on from Enthought. 从Enthought有一个关于入门的视频 Enthought is a company that specializes in scientific calculations. Enthought是一家专门从事科学计算的公司。

Cython has a very good integration with Python that is unmatched by C++ or C (you would have to use #include <Python.h> ). Cython与Python的集成非常好,是C ++或C所无法比拟的(您必须使用#include <Python.h> )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM