python子进程调用makefi

2024-03-28 08:25:30 发布

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

我想使用python(2.6)脚本在makefile中构建目标。makefile$shell命令在make运行时似乎不起作用。在

在构建.py公司名称:

p1 = subprocess.Popen(["gmake","libs"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=1)
p1.wait()
output = p1.returncode
print ("gmake returned with return code " + str (output))

生成文件:

^{pr2}$

结果如下:

***Start building libs libraries at gmake: /mksnt/date.exe: Command not found
gmake: *** [libs] Error 127
gmake returned with return code 2

Tags: 命令脚本目标outputmakereturnwithcode