Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么它不能正确执行python脚本?拉韦尔西蒙尼_Python_Laravel_Symfony - Fatal编程技术网

为什么它不能正确执行python脚本?拉韦尔西蒙尼

为什么它不能正确执行python脚本?拉韦尔西蒙尼,python,laravel,symfony,Python,Laravel,Symfony,运行python脚本后出错: The command "D:\Python\python.exe "/scripts/HelloWorld.py"" failed. Exit Code: 1(General error) Working directory: D:\LabToolLaravel\public Output: ================ Error Output: ================ Fatal Python erro

运行python脚本后出错:

The command "D:\Python\python.exe "/scripts/HelloWorld.py"" failed. 
Exit Code: 1(General error) Working directory: D:\LabToolLaravel\public Output: ================ Error Output: ================ 
Fatal Python error: _Py_HashRandomization_Init: failed to get random numbers to initialize Python Python runtime state: preinitialized
$out=new\Symfony\Component\Console\Output\ConsoleOutput();
$python=“D:\python\python.exe”;
$process=newprocess([$python,'/scripts/HelloWorld.py']);
$process->run();
如果(!$process->isSuccessful()){
抛出新的ProcessFailedException($process);
}
$out->writeln($process->getOutput());
编辑: 如果我使用shell_exec(),它会工作。我想使用Symfony,但我想现在我会使用shell_exec()

$out = new \Symfony\Component\Console\Output\ConsoleOutput();

        $output = shell_exec("D:\Python\python.exe D:\Laravel\public\scripts\HelloWorld.py");

        $out->writeln($output);