gpt4 book ai didi

Python 3.6 ~ 属性错误 : module 'servicemanager' has no attribute 'Initialize' ~ When creating windows service exe

转载 作者:行者123 更新时间:2023-12-05 05:06:21 42 4
gpt4 key购买 nike

Python 3.6.6 中使用任何版本的 servicemanager 时,我得到 AttributeError: module 'servicemanager' has no attribute 'Initialize'*

代码片段:

if __name__ == '__main__':
if len(sys.argv) == 1:
servicemanager.Initialize()
servicemanager.PrepareToHostSingle(RelayService3)
servicemanager.StartServiceCtrlDispatcher()
else:
win32serviceutil.HandleCommandLine(RelayService3)

这似乎是用 python 编写的任何 windows 服务的标准主要功能。

如有任何帮助,我们将不胜感激!

最佳答案

我认为安装servicemanager出错:

\Python38-32\Scripts\pip3 uninstall servicemanager

成功后。

关于Python 3.6 ~ 属性错误 : module 'servicemanager' has no attribute 'Initialize' ~ When creating windows service exe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59959609/

42 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com