【发布时间】:2017-05-16 20:22:24
【问题描述】:
现在有没有一种简单的方法可以使用 scipy 库将 Java 类传递给 .py 程序?
我在 StackExchange 上看到了使用 Jython 的建议(Java Python Integration 和 Using Python from within Java)。我还看到一些帖子说它不适用于 numpy 或类似的库(Integrate Python and his libraries with Java、Calling python functions from *.py files from java and passing and returning 和 Executing Python script from Java in Tomcat project)。
我希望能够将 Java 类传递给 .py 代码,运行 scipy 计算,然后将结果传递回 Java(我目前可以使用 MATLAB .m 文件执行此操作)。我还希望能够将其放在并行处理云服务器上,因为 1) 我的实时 Java 程序(运行 GUI 和主要功能)已经在云上,并且 2) 计算速度至关重要。
【问题讨论】:
-
MATLAB 与 Java 集成已经有一段时间了。但是
scipy与numpy一起使用,并且使用了大量编译后的C代码。所以它最适合使用常规 Python (CPython)。对替代 Python(Jython、Ironpython、Pypy)的适应充其量只是部分适应。