错误:spawn python ENOENT

时间:2017-11-03 15:34:57

标签: python node.js compilation

我正在使用'compile-run' package节点编译并运行一段python代码。当api端点被命中时,我收到以下错误:

events.js:182
  throw er; // Unhandled 'error' event
  ^

Error: spawn python ENOENT
at _errnoException (util.js:1019:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:192:19)
at onErrorNT (internal/child_process.js:374:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)

我的端点代码是:

router.post('/run',function(req,res){


   var code=req.body.code;
    var input="";
    compile_run.runPython(code, input, function (stdout, stderr, err) {
        if(!err){
        console.log("stout "+stdout);
         console.log("stderr "+stderr);
         }
         else{
         console.log(err);
         }
     });
 });

从前端发送的代码是:print" hello"

我无法找出确切的问题。请帮忙! 提前谢谢!

0 个答案:

没有答案