且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将Python及其库与Java集成

更新时间:2022-06-23 09:59:40

不幸的是,像numpyscipy这样的软件包的代码包括用Fortran和C这样的语言编写的扩展模块,这些模块是专门为CPython解释器量身定制的.这使得它们与不支持CPython扩展接口的Jython不兼容.

Unfortunately the code for packages like numpy and scipy includes extension modules written in languages like Fortran and C, which are specifically tailored to the CPython interpreter. That makes them incompatible with Jython, which does not support the CPython extension interface.

您可能要做的***的事情就是让Java程序与您可以用CPython编写的本地托管Python服务器使用某种基于网络的通信,但是这可能会导致效率低下,这取决于所需的程序结构.

Probably the best you could do would be to have your Java programs use some sort of network-based communications with a locally-hosted Python server that you could write in CPython, but that might introduce unacceptable inefficiencies, depending on the necessary program structure.