来自Java的CPython? [英] CPython from Java?

查看:430
本文介绍了来自Java的CPython?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从Java调用CPython代码。有哪些工具/ API /库可以帮助我做到这一点?

I need to call CPython code from Java. What tools/APIs/libraries exist out there to help me do this?

Jython不是一个选项,因为Python代码严重依赖 numpy

Jython is not an option since the Python code is heavily dependent upon numpy.

编辑1: main()函数应该是Java,而不是Python (即我需要将CPython嵌入到Java中,反之亦然。)

edit 1: The main() function should be Java, not Python (i.e. I need to embed CPython into Java, not vice versa.)

编辑2:我还应该提到我将在Java和Python之间传递大型数值数组因此,将两者放入相同的处理空间的解决方案将是更可取的(但不是强制性的。)

edit 2: I should also mention that I'll be passing large numeric arrays between Java and Python and therefore a solution that brings the two into the same process space would be preferable (but not mandatory.)

推荐答案

你可以采取看看如何使用 Jepp 将CPython嵌入到Java中。阅读文档

You can take a look at using Jepp to embed CPython into Java. Read documentation here.

编辑:对于Windows,该项目具有Python 2.4,2.5和2.6的预构建二进制文件。对于Linux / Unix系统,您必须自己构建它。

edit: For windows the project has prebuilt binaries for Python 2.4, 2.5, and 2.6. For Linux/Unix systems, you have to build it yourself.

这篇关于来自Java的CPython?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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