Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我制作了一个我想在我的计算机后台运行的 .pyw python 脚本。 现在,我通过将它放在我的 Windows 7 计算机的 Startup 文件夹中将它设置为启动,这应该会在它启动时触发它启动。
问题是脚本似乎由于某种原因在某个时候停止运行。我认为它只是在我的计算机进入睡眠状态时停止并且之后不再开始运行。
是否有一种“更正确”的方式来运行后台任务,而不会在每次计算机进入睡眠状态时都死掉?
如果确实需要持续运行的后台进程,您应该考虑提供服务。
pywin32帮助使用 python 创建 NT 服务
如果您喜欢 .NET,您也可以尝试IronPython,但我不知道这是否更容易。