pylab的正确加载方式是什么?
What is the correct way to load pylab?
我见过两种加载pylab的方法:
get_ipython().magic(u'pylab inline')
和
%pylab inline
这两种方法等价吗?如果没有,我如何决定使用哪种方法?
是的,它们是等价的。
get_ipython()
returns InteractiveShell
的实例。 InteractiveShell.magic()
方法的 documentation 表示:
magic(‘name -opt foo bar’) is equivalent to typing at the ipython
prompt:
In[ 1]: %name -opt foo bar
另请注意,magic
函数已弃用,应改用函数 run_line_magic
。
我见过两种加载pylab的方法:
get_ipython().magic(u'pylab inline')
和
%pylab inline
这两种方法等价吗?如果没有,我如何决定使用哪种方法?
是的,它们是等价的。
get_ipython()
returns InteractiveShell
的实例。 InteractiveShell.magic()
方法的 documentation 表示:
magic(‘name -opt foo bar’) is equivalent to typing at the ipython prompt:
In[ 1]: %name -opt foo bar
另请注意,magic
函数已弃用,应改用函数 run_line_magic
。