我正在尝试通过jython从java执行用python编写的类和函数。它运行得很好,直到在python中我们遇到了"import clr“,也就是pythonnet。
有谁能告诉我如何使用jython或其他任何使用"import clr“的工具从java运行python脚本吗?
python代码: file.py
import clr使用jython的java代码:
Properties props = new Properties();
Properties preprops = System.getProperties();
PythonInterpreter.initialize(preprops, props, new String[0]);
PythonInterpreter interp = new PythonInterpreter();
interp.exec("<absoulute_path//file.py>");错误:
Exception in thread "main" Traceback (most recent call last):
File "<string>", line 3, in <module>
ImportError: No module named clr发布于 2020-07-18 06:24:44
Jython不提供Python C API,因此您无法使用它构建和使用Python.NET。
https://stackoverflow.com/questions/62953022
复制相似问题