Skip to main content
 首页 » 编程设计

python之如何在 iPython 中使用 deepreload 进行自动重载

2024年12月31日13dudu

我目前使用它在 python 中自动重新加载

%reload_ext autoreload 
%autoreload 2 

但是,我想开始使用 deepreload ( https://ipython.org/ipython-doc/3/api/generated/IPython.lib.deepreload.html )

但是以下不起作用:

import builtins 
from IPython.lib import deepreload 
builtins.reload = deepreload.reload 
 
%reload_ext autoreload 
%autoreload 2 

我怎样才能在 jupyter 中获得深度自动重载

请您参考如下方法:

只是颠倒顺序

%load_ext autoreload 
%autoreload 2 
 
import builtins 
from IPython.lib import deepreload 
builtins.reload = deepreload.reload