我正在执行以下简单的python -v
:
$process = new Process(['python -v']);
$process->run();
try {
if (!$process->isSuccessful())
{
throw new ProcessFailedException($process);
}
}
catch (\Exception $e) {
$this->logger->error($e->getMessage());
}
但我得到了例外:
The command "'python -v'" failed. Exit Code: 127(Command not found) Working directory: /var/www/symfony/symfony/public Output: ================ Error Output: ================ sh: 1: exec: python -v: not found
如果我从外壳程序运行相同的命令,则一切正常。
答案 0 :(得分:1)