matplotlib无法导入pylab

时间:2014-07-15 10:18:10

标签: python numpy matplotlib scipy

我已经在我的电脑上安装了matplotlib,当然还有Numpyscipy,但是当我导入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

据我记得它曾经工作但现在我收到错误消息。我甚至重新安装它但没有帮助。我怎么能解决它?

1 个答案:

答案 0 :(得分:-1)

可能是你遗失了:

import matplotlib as mpl

但是,如果这不起作用。重新安装Anacoda发行版,然后确保安装了numpy和scipy。

程序的顶部是:

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