del <模块名> 就能移除模块,清除环境
[]: import numpy as np
[]: np.pi
[]: Out[41]: 3.141592653589793
[]: del np
[]: np.pi
Traceback (most recent call last):
File "D:\ROOT\AppliedWare\python3\lib\site-packages\IPython\core\interactiveshell.py", line 3291, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-43-fcf8569aec5c>", line 1, in <module>
np.pi
NameError: name 'np' is not defined