java jython 导入错误

标签 java jython

我使用jython在java中调用python脚本(使用第三个lib pykriging)。但我在 java 控制台中收到 ImportError 。我尝试了很多方法,但没有一个有效。 我的代码是这样的:

  public static void main(String[] args) {

    Properties props = new Properties();
    props.put("python.home","D:\\prog\\Python27");
    props.put("python.console.encoding", "UTF-8");
    props.put("python.security.respectJavaAccessibility", "false"); //don't respect java accessibility, so that we can access protected members on subclasses
    props.put("python.import.site","false");
    Properties preprops = System.getProperties();

    PySystemState.initialize(preprops, props, new String[0]);
    PySystemState sys = Py.getSystemState();
    sys.path.append(new PyString("D:\\prog\\Python27"));
    sys.path.append(new PyString("D:\\prog\\Python27\\Lib\\site-packages"));

    PythonInterpreter interp = new PythonInterpreter();
    interp.execfile("pyt/example.py");

}

错误是这样的: enter image description here

最佳答案

也许没有办法实现它,因为“pykriging”依赖于“numpy”,但这不是在 jython 中使用 numpy 的好方法。 Using NumPy and Cpython with Jython

关于java jython 导入错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38292991/

相关文章:

Java 跳过代码行

java - 错误未经授权,需要完全身份验证才能访问此资源

javascript - 尝试在 Jython 中使用 htmlunit 抓取 javascript 网站时出现问题

python - Jython 类型错误 - Maximo 自动化脚本

java - 如何在java web编程中使用虚拟内存(linux文件系统中的交换)

java - 我可以在同一台服务器上安装 jython 和普通 django

user-interface - 是否可以使用 Jython 的 SWT?

java - Maven Spring Boot 应用程序启动失败 - JmxAutoConfiguration.mbeanExporter

java - Google Bigquery 流数据错误

java - 如何使 String 包含 ArrayList 中的每个项目? (JAVA)