pyPath:="D:\\Program Files\\Python\\Python38\\python.exe";
pyCmd:="py -u D:\\project\\python\\test.py";
//创建读写管道
ret:= SysexecNewpipe(0);
if ret then handle:= SysExec(pyPath,pyCmd,nil,false,code);
//获取SysExec进程所在管道的输出内容
Res:= "";
while res="" do
begin
res:= SysexecReadpipe(handle);
sleep(100); //100毫秒读取一次
end
SysTerminate(code, handle);//终止进程
return res;