Ubuntu 14.04升级导致matplotlib错误

Ubuntu 14.04升级导致matplotlib错误

自从升级到 14.04 以来,我运行的任何使用 matplotlib 的 Python 代码都会返回错误。这是我的 ipython 控制台返回的内容

In [1]: import matplotlib.pyplot as plt
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
RuntimeError: module compiled against API version 9 but this version of numpy is 6
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-eff513f636fd> in <module>()
----> 1 import matplotlib.pyplot as plt

/usr/lib/pymodules/python2.7/matplotlib/pyplot.py in <module>()
     22 
     23 import matplotlib
---> 24 import matplotlib.colorbar
     25 from matplotlib import _pylab_helpers, interactive
     26 from matplotlib.cbook import dedent, silent_list, is_string_like, is_numlike

/usr/lib/pymodules/python2.7/matplotlib/colorbar.py in <module>()
     25 
     26 import matplotlib as mpl
---> 27 import matplotlib.artist as martist
     28 import matplotlib.cbook as cbook
     29 import matplotlib.collections as collections

/usr/lib/pymodules/python2.7/matplotlib/artist.py in <module>()
      6 import matplotlib.cbook as cbook
      7 from matplotlib import docstring, rcParams
----> 8 from transforms import Bbox, IdentityTransform, TransformedBbox, \
      9                        TransformedPath, Transform
     10 from path import Path

/usr/lib/pymodules/python2.7/matplotlib/transforms.py in <module>()
     33 import numpy as np
     34 from numpy import ma
---> 35 from matplotlib._path import (affine_transform, count_bboxes_overlapping_bbox,
     36     update_path_extents)
     37 from numpy.linalg import inv

ImportError: numpy.core.multiarray failed to import

答案1

我需要升级 numpy

pip 安装-U numpy

相关内容