%reload_ext autoreload %autoreload 2
Usage¶
The following magic commands are provided:
%autoreload
, %autoreload now
Reload all modules (except those excluded by
%aimport
) automatically now.
%autoreload 0
, %autoreload off
Disable automatic reloading.
%autoreload 1
, %autoreload explicit
Reload all modules imported with
%aimport
every time before executing the Python code typed.
%autoreload 2
, %autoreload all
Reload all modules (except those excluded by
%aimport
) every time before executing the Python code typed.
%autoreload 3
, %autoreload complete
Same as 2/all, but also adds any new objects in the module. See unit test at IPython/extensions/tests/test_autoreload.py::test_autoload_newly_added_objects
Adding
-p
to the%autoreload
line will print autoreload activity to standard out.--log
or-l
will do it to the log at INFO level; both can be used simultaneously.
%aimport
List modules which are to be automatically imported or not to be imported.
%aimport foo
Import module ‘foo’ and mark it to be autoreloaded for
%autoreload 1
%aimport foo, bar
Import modules ‘foo’, ‘bar’ and mark them to be autoreloaded for
%autoreload 1
%aimport -foo
标签:autoreload,imported,Jupyter,modules,autoreloaded,aimport,foo From: https://www.cnblogs.com/zhangzhihui/p/18440782Mark module ‘foo’ to not be autoreloaded.