Windows Service with Python 3.5 and pyinstaller
- Python 3.5.x
- Visual C++ Build Tools 2015
- PyInstaller 3.2
(env)$ python -V
Python 3.5.2
(env)$ pip freeze
PyInstaller==3.2
(env)$ pyinstaller -F --hidden-import=win32timezone WindowsService.py
(env) dist\WindowsService.exe install
Installing service TestService
Service installed
(env) dist\WindowsService.exe start
Starting service TestService
(env) dist\WindowsService.exe stop
(env) dist\WindowsService.exe remove
Same thing happened to me. What happened is, I checked whether it is working in as normal python file . so did python . So it told me servicemanager module missing. So installed it and tried again. Then i got this issue.
After lots of research, what i found is its because of wrong package being installed. So to resolve this, i created an new environment, and then did python install directly, instead of running it like a normal python file. It resolved my problem. Try this