将 python 脚本作为 Windows 服务运行 [英] Run a python script as a windows service

查看:62
本文介绍了将 python 脚本作为 Windows 服务运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在 Windows 7 的系统启动时运行我的 python 3 脚本?

Is there a way to run my python 3 script at system boot on windows 7?

我知道这已经被问过几次了,但没有一个解决方案能真正满足我的需求,因为我更喜欢使用免费的 Python 解释器而不是切换到 ActivePython.

I know this has been asked a couple of times, but none of the solutions really filled my needs, because I prefer to stay with the free python interpreter rather than switching to ActivePython.

我已经安装了 Python for Windows 扩展 并且会使用 py2exe,但它不支持Python 3.

I have installed the Python for Windows extensions and would use py2exe, but it does not support Python 3.

推荐答案

您还可以通过以下步骤使用 Windows 任务计划程序(键入时跳过引号):

You can also use the Windows Task Scheduler using the following steps (skip quotes when typing):

  • 在开始"按钮搜索框中搜索任务计划程序"
  • 创建新任务
  • 在创建任务"对话框中,转到触发器"选项卡并单击新建"按钮
  • 从开始任务"下拉菜单中选择启动时",点击确定"
  • 转到操作"标签并点击新建"按钮
  • 操作"下拉菜单应显示启动程序"
  • 在程序/脚本"框中,输入python.exe"
  • 在添加参数"框中,输入带有任何参数的 Python 脚本的完整路径,例如C:\Scripts\startupscript.py -c onstart"

这篇关于将 python 脚本作为 Windows 服务运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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