1053错误
代码运行没有问题后,安装服务,然而start 的时候出现错误 1053:服务没有及时响应启动或控制请求(Error 1053: The service did not respond to the start or control request in a timely fashion)
试了几个网上找到的代码,都是这个现象,所以应该不是代码的问题。
后面找到解决方法:
What you need to do is to add the Python27 to SYSTEM PATH, and not to USER PATH, since as a default the python service will get installed as a 'LocalSystem' and so when it attempts to start it uses the SYSTEM PATH variable - that's why you can run it from the command prompt, your USER PATH is right.
python默认安装是作为LocalSystem,配置的是用户路径而不是环境变量,所以需要添加环境变量。
在用户变量处去掉python路径,然后在环境变量加入python路径
C:\Users\zhongjianhui\AppData\Local\Programs\Python\Python36\Lib\site-packages\pywin32_system32;
C:\Users\zhongjianhui\AppData\Local\Programs\Python\Python36\Lib\site-packages\win32;
C:\Users\zhongjianhui\AppData\Local\Programs\Python\Python36\Scripts\;C:\Users\zhongjianhui\AppData\Local\Programs\Python\Python36\
start service成功。