I\'m using Ubuntu 14.04 LTS
with an Anaconda python installation:
Python 3.5.1 :: Anaconda 2.4.1 (64-bit)
I\'m tryi
There are two separate things here:
~/.ipython/profile_[name]/startup
that are executed as part of starting IPython. They are treated as if you %run
each of them prior to the first In[1]
prompt. Startup files cannot be imported, because they are not on sys.path
.load_ipython_extension
function. You can put extensions in ~/.ipython/extensions
and they will be importable, or you can install them as regular packages with pip
.The first fix is to move your cppmagics
to ~/.ipython/extensions
or to some site-packages
directory, so that it is importable.
If you really want the magics always registered (rather than calling %load_ext cppmagic
), you can leave it as a startup file and register the magic at the end of the script, instead of def load_ipython_extension
:
if __name__ == '__main__':
from IPython import get_ipython
get_ipython().register_magics(CppMagics)