我试图用python编写一个windows服务,但棘手的是我想将它部署在没有python的机器上。
我已经成功地创建了一个类似this的服务,如果我从我的机器上运行,它就会工作。当我试图将其转换为exe并尝试安装它时,问题就开始了。
首先我尝试使用cx_freeze服务示例(参见here),setup.py如下所示:from cx_Freeze import setup, Executable
options = {'build_exe': {'includes': ['ServiceHandler']}}
executables = [Executable('Config.py', base='Win32Service', targetName='gsr.exe')]
setup(name='GSR',
version='0.1',
description='GSR SERVICE',
executables=executables,
options=options
)
而config.py是:NAME = 'GSR_%s'
DISPLAY_NAME = 'GSR TEST - %s'
MODULE_NAME = 'ServiceHandler'
CLASS_NAME = 'Handler'
DESCRIPTION = 'Sample service description'
AUTO_