ipython storemagic存储所有可用变量 [英] Ipython storemagic to store all available variables
问题描述
我最近在ipython中发现了storemagic,我想用它来保存跨会话的工作.但是,在某些会话中,我会生成大量变量,并且我想在会话结束时说%store all或类似的东西,以便我可以轻松地%store -r并从上次中断的地方继续.
I recently discovered storemagic in ipython, and I would like to use it to save my work across sessions. However, in some sessions I generate a large number of variables, and I would like to say at the end of the session %store all, or something like that, so that I can easily %store -r and continue where I left off.
有什么办法可以做到这一点?请注意,我不太关心命令历史记录,因此,我想要的是不必在每次ipython关闭,冻结或崩溃时都一遍又一遍地运行脚本.
Is there any way I can do this? Note that I do not care much about the commands history and such, what I want is not to have to run the scripts over and over everytime ipython closes, freezes or crashes.
推荐答案
重新发布作为答案:
%store
魔术没有选项来保存整个会话,但是莳萝包具有功能dump_session()
应该可以做到这一点.
The %store
magic doesn't have an option to save the whole session, but the dill package has a function dump_session()
which should do that.
这篇关于ipython storemagic存储所有可用变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!