导入某个库时,PHP中的Python脚本未运行

时间:2017-11-29 19:01:55

标签: php python

我从php运行一个简单的pyton脚本。 python脚本使用此库(https://github.com/ageitgey/face_recognition)。该库是使用导入的 import face_recognition。问题是当我在python中包含此语句时,我在php中没有输出。没有import face_recognition的其他python脚本运行正常。
我已经尝试了

$last_line = system('python test.py ', $retval);

$cmd_modified = $cmd . " >/dev/null & echo \$!";
$cmd_output = NULL; // this will be an array of output
$cmd_return_value = NULL; // this will be the return value of the 

exec($cmd_modified, $cmd_output, $cmd_return_value);
echo "exec has completed</br>";
echo "output:<br>" . print_r($cmd_output, TRUE) . "<br>";
echo "return value: " .  $cmd_return_value ;

我明白了      输出:      数组([0] =&gt; 17424) 返回值:0

该脚本需要5秒才能在终端完成,但我已添加ini_set('max_execution_time', 1200);以防止计时错误

我该怎么办?

0 个答案:

没有答案