title: Python 2.7: Unable to import matplotlib.pyplot
body: <p>When I tried to</p>
  
  <pre><code>import matplotlib.pyplot as plt
  </code></pre>
  
  <p>I was given the following error:</p>
  
  <pre><code>runfile('/Users/Zhengnan/Documents/Python/PS 2/230I_PS_2.py', wdir='/Users/Zhengnan/Documents/Python/PS 2')
  Traceback (most recent call last):
  
  File "&lt;ipython-input-2-9001323bba15&gt;", line 1, in &lt;module&gt;
  runfile('/Users/Zhengnan/Documents/Python/PS 2/230I_PS_2.py', wdir='/Users/Zhengnan/Documents/Python/PS 2')
  
  File "/Users/Zhengnan/anaconda/lib/python2.7/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 685, in runfile
  execfile(filename, namespace)
  
  File "/Users/Zhengnan/anaconda/lib/python2.7/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 78, in execfile
  builtins.execfile(filename, *where)
  
  File "/Users/Zhengnan/Documents/Python/PS 2/230I_PS_2.py", line 4, in &lt;module&gt;
  import matplotlib.pyplot as plt
  
  File "/Users/Zhengnan/anaconda/lib/python2.7/site-packages/matplotlib/pyplot.py", line 27, in &lt;module&gt;
  import matplotlib.colorbar
  
  File "/Users/Zhengnan/anaconda/lib/python2.7/site-packages/matplotlib/colorbar.py", line 34, in &lt;module&gt;
  import matplotlib.collections as collections
  
  File "/Users/Zhengnan/anaconda/lib/python2.7/site-packages/matplotlib/collections.py", line 27, in &lt;module&gt;
  import matplotlib.backend_bases as backend_bases
  
  File "/Users/Zhengnan/anaconda/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 56, in &lt;module&gt;
  import matplotlib.textpath as textpath
  
  File "/Users/Zhengnan/anaconda/lib/python2.7/site-packages/matplotlib/textpath.py", line 22, in &lt;module&gt;
  from matplotlib.mathtext import MathTextParser
  
  File "/Users/Zhengnan/anaconda/lib/python2.7/site-packages/matplotlib/mathtext.py", line 63, in &lt;module&gt;
  import matplotlib._png as _png
  
  ImportError: dlopen(/Users/Zhengnan/anaconda/lib/python2.7/site-packages/matplotlib/_png.so, 2): Library not loaded: @loader_path/../../../libpng15.15.dylib
  Referenced from: /Users/Zhengnan/anaconda/lib/python2.7/site-packages/matplotlib/_png.so
  Reason: image not found
  </code></pre>
  
  <p>Can anyone please help me? I'm a newbie and not really familiar with paths. A step-by-step instruction would be greatly appreciated. Thanks in advance.</p>
  
  <p>BTW, I'm using spyder as an IDE.</p>