从PHP开始运行Python脚本,但不是结束i

2024-09-28 01:34:03 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试从PHP运行Python脚本。我已经尝试过使用:system()、exec()和shell\u exec()函数。现在我的PHP看起来像:

<?php
system('./main.py');
echo 'succes';
?>

我在Python脚本中创建了一些print()函数,发现它停在这一行:

QueryImgBGR = cv2.imread(image_path)

PHPecho()正在工作,但是system()函数没有结束。正在从控制台运行Python脚本

我正在使用python3.5.3(使用numpy、cv2和os库)和php7.2.4(system()、shell_exec()、exec()函数解锁)开发Debian 4.9.30

编辑:Python中的Someway print()函数在新行上打印,但system()函数在一行空间中打印所有内容


Tags: 函数pyecho脚本mainshellcv2system

热门问题