gpt4 book ai didi

java - 在 Java 中使用 Python

转载 作者:IT老高 更新时间:2023-10-28 20:23:47 25 4
gpt4 key购买 nike

Possible Duplicate:
Java Python Integration

我有一个 100% 用 Ja​​va 编写的大型现有代码库,但我想将 Python 用于其中的一些新部分。我需要做一些文本和语言处理,我更愿意使用 Python 和像 NLTK 这样的库这样做。

I'm aware of the Jython project, but it looks like this represents a way to use Java and its libraries from within Python, rather than the other way round - am I wrong about this?

If not, what would be the best method to interface between Java and Python, such that (ideally) I can call a method in Python and have the result returned to Java?

最佳答案

I'm aware of the Jython project, but it looks like this represents a way to use Java and its libraries from within Python, rather than the other way round - am I wrong about this?

是的,你错了。您可以call a command line interpreter使用 Jyton 或 use python code from Java 运行 python 代码.过去也有 python-to-Java 编译器,但在 Jython 2.2 中停止使用

关于java - 在 Java 中使用 Python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1164810/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com