有没有办法更改配置文件以使 jupyter qtconsole 在启动时运行以下命令?:
%matplotlib inline
将此行添加到ipython_config.py
文件(不是ipython_qtconsole_config.py
文件):
c.InteractiveShellApp.matplotlib = 'inline'
在您的ipython_config.py
文件中,您可以通过设置指定在启动时运行的命令(包括魔术 % 命令)c.InteractiveShellApp.exec_lines
。例如,
c.InteractiveShellApp.exec_lines = """
%matplotlib inline
%autoreload 2
import your_favorite_module
""".split('\n')
打开文件~/.ipython/profile_default/ipython_config.py
,然后
c.InteractiveShellApp.code_to_run = ''
==>
c.InteractiveShellApp.code_to_run = '%pylab inline'