2015-08-07 9 views
5

In IPython, posso caricare un'estensione personalizzata mediante semplice comando:IPython: estensione carico automaticamente all'accensione

%load_ext physics 

Questo caricherà il file ~/.config/ipython/extensions/physics.py.

Come posso dire a IPython di caricare automaticamente l'estensione all'avvio?

ho aggiunto la linea di /.config/ipython/profile_default/startup/import.py, ma che non funziona:

from numpy import * 

%load_ext physics 

Quando inizio IPython, vengo folowing errore:

File "~.config/ipython/profile_default/startup/import.py", line 17 
%load_ext physics 
^ 
SyntaxError: invalid syntax 

risposta

4

Dalla documentazione IPython:

Using extensions

To load an extension while IPython is running, use the %load_ext magic:

In [1]: %load_ext myextension 

To load it each time IPython starts, list it in your configuration file:

c.InteractiveShellApp.extensions = [ 
    'myextension' 
] 

Speranza che aiuti

+0

funziona perfettamente. Grazie –