简体   繁体   中英

Windows service running in a Anaconda environment?

I need to run a Flask application as a Windows service. I managed to convert it to a Windows service using win32serviceutil. The problem I have is that it only works when I manually run PythonService.exe (with the -debug flag) from the "activated" environment (of course).

Is there a way to activate the environment before attempting to run the service?

I see some people used the Task Scheduler as a workaround but I'd prefer if Windows service manager could be used instead.

I figured it out. The trick is to use pyinstaller to generate an EXE. This way all libraries will be included, and there will be no need to mess with the system environment variables.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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