从Scala(或Java)使用python代码的最佳方法是什么? [英] What is the best way to use python code from Scala (or Java)?

查看:140
本文介绍了从Scala(或Java)使用python代码的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
Java Python集成

Possible Duplicate:
Java Python Integration

有一些用Python编写的代码,我需要在Scala中使用它.该代码使用一些本机C.是否可以在Scala或Java中使用它而无需大量重写?

There is some code written in Python and I need to use it from Scala. The code uses some native C. Is it possible to use this from Scala or Java without having to rewrite much?

我打算在不理解的情况下将代码用作黑匣子,因此我不希望对其进行研究,而宁愿以某种方式生成可以导入我的代码中的jar.

I intend to use the code as a black-box without understanding, so I prefer not to look into it but rather to somehow generate a jar that I can import in my code.

推荐答案

为什么不尝试 Jython ?您直接将python代码编译为Java类,或通过接口从Java调用Python代码.

Why not try Jython?You directly compile python code to Java classes or call Python code from Java through interface.

这篇关于从Scala(或Java)使用python代码的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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