【问题标题】:How to schedule a script to run daily on jupyter notebook?如何安排脚本每天在 jupyter notebook 上运行?
【发布时间】:2021-08-17 09:33:24
【问题描述】:

我在内部云上使用 Jupyter 笔记本。并且有一个脚本需要每天运行。有没有办法让它每天自动运行?

我在某处读到这可以使用 Cron 完成,所以我尝试安装以下内容,但每次它都会出现以下错误:

!pip install jupyterlab-scheduler

ERROR: Could not find a version that satisfies the requirement jupyterlab-scheduler (from versions: none)
ERROR: No matching distribution found for jupyterlab-scheduler

!pip install jupyter-cron

ERROR: Could not find a version that satisfies the requirement jupyter-cron (from versions: none)
ERROR: No matching distribution found for jupyter-cron

任何帮助将不胜感激。 谢谢!

【问题讨论】:

标签: python cron cloud jupyter scheduler


【解决方案1】:

我想感谢@Vincent Stevenson

如果您使用的是 Windows 10,则可以执行以下操作:

将你的 jupyter notebook 保存为 .py 文件

转到Control Panel --> Administrative Tools --> Task Scheduler--> Create Task

  1. 任务计划程序,创建任务

  2. 给任务一个标题

  3. 转到操作

  4. 去CMD找路径,

    Python,导入 sys,sys.executable

    (这会告诉您应该在 Program/script 字段 中填充什么内容:“some path 主要是 Appdata")

    喜欢:C:\Users\admin\AppData\Local\Programs\Python\Python38-32\python.exe

  5. 参数:python脚本的名称(如run.py)

  6. Start in:python脚本的dir位置(如:C:\Users\admin\Documents\my_python_project)

  7. 转到触发器,安排每日

  8. 通过运行脚本来测试它

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-05
    • 2020-07-19
    • 2018-07-22
    • 1970-01-01
    相关资源
    最近更新 更多