我有以下Java代码片段,它适用于Python 2兼容的脚本。但是,当我在Java中使用Python 3兼容的脚本时,我没有得到任何输出。
String[] cmd = {
python,
file.getAbsolutePath(),
};
String[] envCommand = {"source activate root"}; //My root environment is having python3,
Runtime runtime = Runtime.getRuntime();
process = runtime.exec(cmd, envCommand);
readOutputFromPythonProcess(process);发布于 2017-05-18 14:30:17
在使用exec时,请确保将python设置为"python3",并读取错误流以查找脚本将给出的任何错误
https://stackoverflow.com/questions/44035383
复制相似问题