2015-10-20 62 views

回答

8

此行添加到ipython_config.py文件(ipython_qtconsole_config.py文件):

c.InteractiveShellApp.matplotlib = 'inline' 
+1

真棒。我不知道可以用ipython_config.py文件完成的所有定制工作......如果其他人还没有该文件,请运行'ipython profile create'。 – snd

2

在你ipython_config.py文件,你可以通过设置c.InteractiveShellApp.exec_lines指定命令,在启动时运行(包括魔术%命令) 。例如,

c.InteractiveShellApp.exec_lines = """ 
%matplotlib inline 
%autoreload 2 
import your_favorite_module 
""".split('\n') 
+1

根据文档http://ipython.readthedocs.io/en/stable/development/config.html,默认情况下,'ipython_config.py'在'$ HOME/.ipython/profile_default /'下。 –

1

打开文件~/.ipython/profile_default/ipython_config.py,和

c.InteractiveShellApp.code_to_run = '' 

==>

c.InteractiveShellApp.code_to_run = '%pylab inline'