简体   繁体   中英

matplotlib can not import pylab

I have installed matplotlib and of course its requirements Numpy and scipy on my pc but I get this error message when I import pylab :

   >>> from matplotlib import pylab
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/anaconda/lib/python2.7/site-packages/matplotlib-1.4.x-py2.7-linux-x86_64.egg/matplotlib/pylab.py", line 230, in <module>
    import matplotlib.finance
  File "/anaconda/lib/python2.7/site-packages/matplotlib-1.4.x-py2.7-linux-x86_64.egg/matplotlib/finance.py", line 36, in <module>
    from matplotlib.dates import date2num
  File "/anaconda/lib/python2.7/site-packages/matplotlib-1.4.x-py2.7-linux-x86_64.egg/matplotlib/dates.py", line 137, in <module>
    import matplotlib.ticker as ticker
  File "anaconda/lib/python2.7/site-packages/matplotlib-1.4.x-py2.7-linux-x86_64.egg/matplotlib/ticker.py", line 138, in <module>
    from matplotlib import transforms as mtransforms
  File "/anaconda/lib/python2.7/site-packages/matplotlib-1.4.x-py2.7-linux-x86_64.egg/matplotlib/transforms.py", line 39, in <module>
    from matplotlib._path import (affine_transform, count_bboxes_overlapping_bbox,
ImportError: /anaconda/lib/python2.7/site-packages/matplotlib-1.4.x-py2.7-linux-x86_64.egg/matplotlib/_path.so: undefined symbol: PyUnicodeUCS2_AsEncodedString

As far as I remember it used to work but now I get error message. I even re-installed it but didn't help. How could I fix it?

It may be that you are missing:

import matplotlib as mpl

However, if that does not work. Reinstall the Anacoda distribution, then make sure you have numpy and scipy installed.

The top of your program is then:

import numpy as np
import scipy
import matplotlib as mpl
import pylab

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM