http://stackoverflow.com/questions/35595766/matplotlib-line-magic-causes-syntaxerror-in-python-script
Line magics are only supported by the IPython command line. You cannot use it inside a script like this because it is not correct Python syntax.
If you want to do this from a script you have to get access to the IPython API and then call the run_line_magic function.
Instead of %matplotlib inline, you will have to do something like this in your script:
from IPython import get_ipython get_ipython().run_line_magic('matplotlib', 'inline') 10 down voteLine magics are only supported by the IPython command line. You cannot use it inside a script like this because it is not correct Python syntax.
If you want to do this from a script you have to get access to the IPython API and then call the run_line_magic function.
Instead of %matplotlib inline, you will have to do something like this in your script:
from IPython import get_ipython get_ipython().run_line_magic('matplotlib', 'inline')