简体   繁体   English

py2exe windows服务问题

[英]py2exe windows service problem

I have successfully converted my python project to a service. 我已成功将我的python项目转换为服务。 When using the usual options of install and start/stop, everything works correctly. 使用通常的安装和启动/停止选项时,一切正常。 However, I wish to compile the project using py2exe, which seems to work correctly until you install the EXE as a service and try and run it. 但是,我希望使用py2exe编译项目,这似乎正常工作,直到您将EXE作为服务安装并尝试运行它。

You get the following error message: 您收到以下错误消息:

  • Starting service CherryPyService 启动服务CherryPyService
  • Error starting service: The service did not respond to the start or control request in a timely fashion. 启动服务时出错:服务未及时响应启动或控制请求。

My compile python file (which links to the main project) is as follows: 我的编译python文件(链接到主项目)如下:

  • from distutils.core import setup 来自distutils.core导入设置
  • import py2exe 导入py2exe

  • setup(console=['webserver.py']) 设置(控制台= [ 'webserver.py'])

Any help would be greatly appreciated. 任何帮助将不胜感激。

You setup.py file should contain 你应该包含setup.py文件

setup(service=["webserver.py"])

as shown in the "old" py2exe docs “旧”py2exe文档中所示

您将在py2exe包中找到一个示例,请查看site-packages \\ py2exe \\ samples \\ advanced。

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

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