我想安排一个 python 脚本在每个工作日的凌晨 3 点开始并在下午 5 点休息.然而,当我需要启动 virtualenv 时问题就出现了,因为所有的包都安装在虚拟环境中.我可以让它在特定时间运行,但是我无法激活虚拟环境(我通常会输入env\scripts\activate").这是我的操作:
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:
关于如何合并激活 virtualenv 以及我的操作应该如何破坏脚本的任何想法?谢谢
Any idea on how I can incorporate activating virtualenv and what my action should looks like to break the script? Thanks
推荐答案执行批处理脚本 (test.bat) 而不是调用 python.exe
Execute a batch script (test.bat) instead of calling python.exe
通过复制 activate.bat 文件来创建这样的 test.bat.在 test.bat 末尾添加使用您自己的 python 文件调用 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.
更多推荐
使用 Windows 任务计划程序安排 [Virtualenv Dependent] Python 脚本
发布评论