Python中文
首页
教程
问答
标签
搜索
登录
注册
用Python接口C(或C++)有什么不同的选择?
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我知道有很多方法可以将C函数接口到Python中:<a href="http://docs.python.org/c-api/" rel="nofollow noreferrer">Python C API</a>,<a href="http://www.scipy.org/Weave" rel="nofollow noreferrer">scipy.weave</a>,<a href="http://docs.python.org/library/ctypes.html" rel="nofollow noreferrer">ctypes</a>,<a href="http://cython.org/" rel="nofollow noreferrer">pyrex/cython</a>,<a href="http://www.swig.org/" rel="nofollow noreferrer">SWIG</a>,<a href="http://www.boost.org/doc/libs/1_46_1/libs/python/doc/" rel="nofollow noreferrer">Boost.Python</a>,<a href="http://psyco.sourceforge.net/" rel="nofollow noreferrer">Psyco</a>。。。他们每一个最适合做什么?为什么我要用一个给定的方法而不是其他方法?当我需要在Python和C之间选择绑定时,应该考虑什么?在</p> <p>我知道一些关于这个的讨论,但它们似乎都是不完整的。。。在</p> <ul> <li><a href="http://wiki.cython.org/SWIG" rel="nofollow noreferrer">http://wiki.cython.org/SWIG</a></li> <li><a href="http://sage.math.washington.edu/tmp/sage-2.8.12.alpha0/doc/prog/node35.html" rel="nofollow noreferrer">http://sage.math.washington.edu/tmp/sage-2.8.12.alpha0/doc/prog/node35.html</a></li> </ul> <p>我知道关于StackOverflow的一些问题也是相关的。例如:</p> <ul> <li><a href="https://stackoverflow.com/questions/1942298/wrapping-a-c-library-in-python-c-cython-or-ctypes">About interfacing an existing C library</a></li> <li><a href="https://stackoverflow.com/questions/5720272/are-there-advantages-to-use-the-python-c-interface-instead-of-cython">C API vs Cython</a></li> </ul>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>这只是对您问题的一部分的简短回答,但是:</p> <p><code>ctypes</code>可能是最好的,当您有一个预先存在的C库,您想与Python一起使用。在</p> <p>当您想用C编写一些利用Python特性的东西,或者想用C编写Python的扩展时,pythoncapi是最好的选择</p> <p>当然,这两个问题可能会在你的问题中链接到的一些SO问题的答案中进行更详细的阐述。在</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
如何在python中从数据帧列中删除分类值?
6 回答
如何在python中从数据帧列表中删除引号
9 回答
如何在python中从数据帧创建列表
10 回答
如何在Python中从数据帧创建嵌套的JSON
7 回答
如何在Python中从数据帧显示wordcloud
1 回答
如何在Python中从数据帧的时间戳中删除字符
8 回答
如何在Python中从数据帧绘制简单绘图?
3 回答
如何在python中从数据帧行提取具有特定长度的范围?
4 回答
如何在python中从数据帧设置dict中的值
10 回答
如何在Python中从数据库中获得一个结果
3 回答
如何在python中从数据框中绘制分类条形图
2 回答
如何在Python中从数据框中选择特定细节?
1 回答
如何在python中从数据集中删除unicode
8 回答
如何在python中从数据集中删除某些数值?
3 回答
如何在python中从数据集中选择行
6 回答
如何在Python中从数组中删除元素
1 回答
如何在python中从数组中删除单个倒逗号?
2 回答
如何在python中从数组中删除对象?
3 回答
如何在python中从数组中删除引号
2 回答
如何在python中从数组中删除所有最小值
2 回答