python - Python 3.6 ~ AttributeError: module 'servicemanager' has no attribute 'Initialize' ~ 创建windows service exe时
问题描述
当使用 with 的任何版本时servicemanager
,Python 3.6.6
我得到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)
这似乎是任何windows
用python
.
任何帮助将不胜感激!
解决方案
我认为安装 servicemanager 错误:
\Python38-32\Scripts\pip3 uninstall servicemanager
在它工作之后。
推荐阅读
- web-scraping - 为什么我不能用scrapy将数据导入csv?
- sql - 使用 SQL 创建时间表
- google-apps-script - 错误:URL 内容中的资源已超过最大大小。- 是否可以通过脚本重现 IMPORTXML 以避免此类问题?
- c - 包含对另一个结构的引用的 C 结构
- regex - 正则表达式中的非捕获组
- python - 填充熊猫数据框中的缺失值
- flutter - Flutter:影响第一行的行距,定位小部件的问题作为解决方案
- node.js - 从数组中的mongoDB获取字段而不更新数据
- angular9 - IONIC5 和 ANGULAR 9 升级 - 错误 NG8001
不是已知元素 - javascript - 允许客户端编写和执行条件语句的 Web 界面