Schedule [Virtualenv Dependent] Python Script with Windows Task Scheduler

て烟熏妆下的殇ゞ 提交于 2020-01-03 04:20:12

问题


I want to schedule a python script to start at 3AM and break at 5PM every weekday. However the problem arises when I need to start virtualenv as all the packages are install in a virtual environment. I can get it to run at a specific time, however I can't activate the virtual environment (I'd normally type "env\scripts\activate"). Here is what my action looks like:

Any idea on how I can incorporate activating virtualenv and what my action should looks like to break the script? Thanks


回答1:


Execute a batch script (test.bat) instead of calling python.exe

Create such test.bat by copying activate.bat file. At the end of the test.bat add calling python.exe with your own python file.



来源:https://stackoverflow.com/questions/40412771/schedule-virtualenv-dependent-python-script-with-windows-task-scheduler

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!