python SyntaxError: invalid syntax %matplotlib inline
<p>I got this error in my python script:</p>

<pre><code>%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt

from utils import progress_bar_downloader
import os
#Hosting files on my dropbox since downloading from google code is painful
#Original project hosting is here: https://code.google.com/p/hmm-speech-recognition/downloads/list
#Audio is included in the zip file
link = 'https://dl.dropboxusercontent.com/u/15378192/audio.tar.gz'
dlname = 'audio.tar.gz'

if not os.path.exists('./%s' % dlname):
    progress_bar_downloader(link, dlname)
    os.system('tar xzf %s' % dlname)
else:
    print('%s already downloaded!' % dlname)
</code></pre>

<p>I want use matplotlib but it gives syntax error,
I tried sudo apt-get install python-matplotlib</p>

<p>"%matplotlib inline" isn't valid python code, so you can't put it in a script.</p>

<p>I assume you're using a Jupyter notebook? If so, put it in the first cell and all should work.</p>

python