小编Tus*_*har的帖子

restify.serveStatic不是函数错误

我正在使用以下脚本,但是这个脚本抛出错误,即serveStatic不是我安装的函数,使用此命令"npm install --save restify"

var restify = require('restify');
var builder = require('botbuilder');

var server = restify.createServer();

server.listen(process.env.port || process.env.PORT || 3978, function () { });



// Create the chat connector for communicating with the Bot Framework Service
var connector = new builder.ChatConnector({
    appId: '***',
    appPassword: '***'
});

// Listen for messages from users 
server.post('/api/messages', connector.listen());

server.get('/', restify.serveStatic({
 directory: __dirname,
 default: '/index.html'
}));


var bot = new builder.UniversalBot(connector, function (session) {
    var msg = session.message;
    if (msg.attachments && msg.attachments.length > 0) …
Run Code Online (Sandbox Code Playgroud)

node.js npm restify

7
推荐指数
1
解决办法
1896
查看次数

使用 php 页面调用 OpenCV python 脚本

我正在尝试通过 php 页面运行用于图像检测的 Python 脚本,并捕获并显示 py 脚本生成的输出。

这是我的 python 脚本GITHUB LINK

我正在使用以下代码运行 python 脚本:

$command = escapeshellcmd('sudo python Main.py');
$output = shell_exec($command);
echo $output;
Run Code Online (Sandbox Code Playgroud)

这会产生此错误:

Traceback (most recent call last):
  File "Main.py", line 3, in <module>
    import cv2
ImportError: No module named cv2
Run Code Online (Sandbox Code Playgroud)

****但是当使用终端独立执行时,相同的脚本可以正常工作。我使用anaconda安装Opencv****

提前致谢 :)

php python linux opencv anaconda

1
推荐指数
1
解决办法
1497
查看次数

标签 统计

anaconda ×1

linux ×1

node.js ×1

npm ×1

opencv ×1

php ×1

python ×1

restify ×1