我的快递服务器代码如下所示,我使用下面的路由器来调用python代码,该代码测试codelab中提到的重新训练的模型。
router.get('/imagePrediction',function(req,res,next){
var PythonShell = require('python-shell');
var options = {
mode: 'text',
pythonPath: 'usr/bin/python',
pythonOptions: ['-u'],
scriptPath: __dirname,
args: ['retrained_graph.pb', 'unsafe.jpg']
};
PythonShell.run('/label_image.py', options, function (err, results) {
if (err)
res.send(err);
// Results is an array consisting of messages collected during execution
res.send('results: %j', results);
});
我收到输出错误:
Error: /anaconda3/bin/python: No module named /Users/abc/Desktop/label_image