用Makefile执行的Python脚本 [英] Python Script Executed with Makefile

查看:61
本文介绍了用Makefile执行的Python脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写python脚本,并在Makefile中执行它们.python脚本用于处理管道中的数据.我希望Makefile每次更改python脚本时都执行脚本.

I am writing python scripts and execute them in a Makefile. The python script is used to process data in a pipeline. I would like Makefile to execute the script every time I make a change to my python scripts.

有人知道怎么做吗?

推荐答案

信息不多,所以这个答案有点含糊.Makefile的基本原理是列出每个目标的依赖性.在这种情况下,您的目标(我们将其称为foo)取决于您的python脚本(我们将其称为do-foo.py):

That's not a lot of information, so this answer is a bit vague. The basic principle of Makefiles is to list dependencies for each target; in this case, your target (let's call it foo) depends on your python script (let's call it do-foo.py):

foo: do-foo.py
    python do-foo.py > foo

现在,只要do-foo.py发生更改,foo就会重新运行(当然,前提是您要调用make).

Now foo will be rerun whenever do-foo.py changes (provided, of course, you call make).

这篇关于用Makefile执行的Python脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆