jupyter notebook不显示运行日期
时间: 2023-10-16 10:09:49 浏览: 239
您可以在jupyter notebook中的cell中输入以下代码来显示运行日期:
```python
from datetime import datetime
print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
```
这将打印出当前日期和时间。如果您想在每个cell中都显示日期,可以将此代码放在notebook的开头cell中,并将其标记为raw格式。
相关问题
crontab定时运行jupyter notebook
可以使用crontab来定时运行jupyter notebook,具体步骤如下:
1. 打开终端,输入命令:crontab -e,打开crontab编辑器;
2. 在编辑器中添加一行类似于以下的定时任务:
```
* * * * * cd /path/to/your/notebook && /path/to/anaconda/bin/jupyter nbconvert --to notebook --execute your_notebook.ipynb
```
其中,第一个星号表示分钟数,第二个星号表示小时数,第三个星号表示日期,第四个星号表示月份,第五个星号表示星期几。以上的星号都可以用数字代替,例如"0 8 * * 1"表示每周一的8点。"/path/to/your/notebook"为你的notebook所在目录的路径,"your_notebook.ipynb"为你的notebook文件名。请将命令中的路径替换为你自己的路径。
3. 保存退出即可。
请注意,以上命令需要在Linux或MacOS系统中使用。如果你使用Windows系统,请使用Windows Task Scheduler来实现类似的定时任务。
阅读全文
相关推荐

















