pom
<dependency>
<groupId>org.python</groupId>
<artifactId>jython-standalone</artifactId>
<version>2.7.0</version>
</dependency>
代码
package com.imooc;
import org.python.util.PythonInterpreter;
public class Test {
public static void main(String[] args) {
PythonInterpreter interpreter = new PythonInterpreter();
interpreter.exec("print('Hello World')"); //此处python语句是3.x版本的语法
}
}
参考网上资料 自测得出