您的位置:首页 > 编程语言 > Python开发

解决java调用python的Cannot import site module and its dependencies: No module named site问题

2017-05-02 11:20 1231 查看
Properties props = new Properties();
props.put("python.home", "path to the Lib folder");
props.put("python.console.encoding", "UTF-8");
props.put("python.security.respectJavaAccessibility", "false");
props.put("python.import.site", "false");
Properties preprops = System.getProperties();
PythonInterpreter.initialize(preprops, props, new String[0]);

——————————分界线————————————

PythonInterpreter interpreter = new PythonInterpreter();
interpreter.execfile("C:/Python27/asdd.py");

分界线以上   解决调用python出现的Cannot import site module and its dependencies: No module named site问题

以下   正常调用方法
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  python java
相关文章推荐