简体   繁体   English

如何安排从anaconda运行的python脚本?

[英]How to schedule python script run from anaconda?

I want every twenty minutes python script to be run from anaconda prompt.我希望每 20 分钟从 anaconda 提示符运行一次 python 脚本。 ie I want command:即我想要命令:

python script.py --argument arg

to be run every twenty minutes.每二十分钟运行一次。 I saw package called schedule and that I can run python scripts via Task Manager but those things seem to be not suitable for my problem (Task Manager can run script.py every twenty minutes, but there is not option to provide my argument arg to it).我看到了一个名为schedule包,我可以通过任务管理器运行 python 脚本,但这些东西似乎不适合我的问题(任务管理器可以每二十分钟运行一次script.py ,但没有选项可以向它提供我的参数arg )。

Could you please help me with doing so?你能帮我这样做吗?

You can do it from a python script您可以从 python 脚本中完成

import time

while True:
    os.system('python --argument arg')
    time.sleep(1800)
    

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM