Issue
In IPython, I can load a custom extension using simple command:
%load_ext physics
This will load the file ~/.ipython/extensions/physics.py
.
How can I tell IPython to load the extension automatically on startup?
I have added the line to /.ipython/profile_default/startup/import.py
, but that does not work:
from numpy import *
%load_ext physics
When I start IPython, I get folowing error:
File "~/.ipython/profile_default/startup/import.py", line 17
%load_ext physics
^
SyntaxError: invalid syntax
Solution
From the IPython documentation:
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' ]
Hope that helps
Answered By - Joseph Stover
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.