本文介绍了我可以在CyPy中嵌入CPython吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用Python编写对性能敏感的应用程序,因此在PyPy下执行它是很自然的选择.但是,我的代码很大一部分取决于numpy,scipy和scikit-learn.为了调用面向数组的代码,是否可以将CPython实例嵌入正在运行的PyPy程序中?如果没有,那么使PyPy和CPython相互交谈的最简单方法是什么?

I'd like to write a performance-sensitive application in Python, so executing it under PyPy is a natural choice. However, a significant portion of my code depends on numpy, scipy, and scikit-learn. Would it be possible to embed a CPython instance within a running PyPy program in order to call array-oriented code? If not, what's the easiest way to make PyPy and CPython talk to each other?

推荐答案

不,您不能将CPython嵌入PyPy AFAIK中.但是,您可以使用分布式/并行执行系统来使PyPy与CPython对话. execnet Pyro 提到了这种精确的PyPy <-> CPython用例. Python Wiki的并行处理页中的其他软件包也可能适用.

No, you can't embed CPython inside PyPy AFAIK. You can, however, use distributed/parallel execution systems to make PyPy talk to CPython. Both execnet and Pyro mention this precise PyPy <-> CPython use case. Other packages from Python Wiki's Parallel Processing page are probably suitable too.

正如delnan所提​​到的,当前的讨论关于在PyPy中实现Numpy的PyPy开发人员的计划(其中不包括对scipy的支持,以及scikit.learn为止).

Also, as delnan mentions, there's a current discussion about PyPy developers' plan on implementing Numpy in PyPy (which doesn't include support for scipy, and scikit.learn so far).

这篇关于我可以在CyPy中嵌入CPython吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-09 23:12