How to autosave ipython notebook

别等时光非礼了梦想. 提交于 2019-12-10 17:27:48

问题


Does anyone know if there's an option (or a suggested hack) to make IPython notebooks save automatically before executing a cell?

Many times I've been working on something without saving for quite some time, then I execute a stupid command that prints so much crap to the console that my browser becomes unresponsive, leading to me losing all my work.

A timed autosave might also do the trick.


回答1:


The development version has that feature fully implemented. Install it by following the instructions on the ipython github.

Instructions form the repo:

If you want to hack on certain parts, e.g. the IPython notebook, in a clean environment (such as a virtualenv) you can use pip to grab the necessary dependencies quickly:

 $ git clone --recursive https://github.com/ipython/ipython.git
 $ cd ipython
 $ pip install -e ".[notebook]"

This installs the necessary packages and symlinks IPython into your current environment so that you can work on your local repo copy and run it from anywhere:

 $ ipython notebook



回答2:


Updating iPython Notebook solved several problems I had with iPython Notebook; for instance, it autosaves, or auto-correction is disabled, or %matplotlib inline works now (before updating, I had to use --pylab inline in the command line when I was running $ipython notebook).

As I use coda on my mac, I updated iPython Notebook via conda:

$conda update ipython




回答3:


You could simply set a lower interval for autosave feature using the following magic command:

%autosave 60

in order to save automatically your notebook every 60 seconds.



来源:https://stackoverflow.com/questions/21517296/how-to-autosave-ipython-notebook

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