Exception in thread "main" ImportError: Cannot import site module and its dependencies: No module named site
http://www.cnblogs.com/liinux/p/5481849.html
public class JpythonScript { public static void main(String args[]) { Properties props = new Properties(); props.put("python.import.site", "false"); Properties preprops = System.getProperties(); PythonInterpreter.initialize(preprops, props, new String[0]); PythonInterpreter interpreter = new PythonInterpreter(); interpreter.exec("days=('mod','Tue','Wed','Thu','Fri','Sat','Sun'); "); interpreter.exec("print days[1];"); }
// 进行复杂类接受处理
Map<String, Object> res = new HashMap<String, Object>();
res.put("1", "Danny");
res.put("2", "Fanny");
PythonInterpreter interpM = new PythonInterpreter();
interpM.execfile("./src/com/DataDeal.py");
PyFunction pyFunctionM = (PyFunction) interpM.get("main",
PyFunction.class);
Map<PyObject, PyObject> tableM = new HashMap<PyObject, PyObject>();
tableM.put(new PyString("conf"), PyJavaType.wrapJavaObject(res));
PyDictionary pydM = new PyDictionary(tableM);