导入matplotlib时numpy的版本错误

oro*_*ome 7 macos packages numpy matplotlib osx-mavericks

当我

import matplotlib
Run Code Online (Sandbox Code Playgroud)

我没有错,但是当我

import matplotlib.pyplot
Run Code Online (Sandbox Code Playgroud)

我明白了

RuntimeError: module compiled against API version 8 but this version of numpy is 7
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/matplotlib/pyplot.py", line 24, in <module>
    import matplotlib.colorbar
  File "/Library/Python/2.7/site-packages/matplotlib/colorbar.py", line 27, in <module>
    import matplotlib.artist as martist
  File "/Library/Python/2.7/site-packages/matplotlib/artist.py", line 8, in <module>
    from transforms import Bbox, IdentityTransform, TransformedBbox, \
  File "/Library/Python/2.7/site-packages/matplotlib/transforms.py", line 35, in <module>
    from matplotlib._path import (affine_transform, count_bboxes_overlapping_bbox,
ImportError: numpy.core.multiarray failed to import
Run Code Online (Sandbox Code Playgroud)

这看起来像版本错误 ; 但yolk我说我有一个最新的版本,并pip说一切都是最新的,不会帮助"真正"更新事情.

我该怎么做才能确保必要的软件包"真正"最新以避免此错误; 什么包需要"真正"更新(matplotlib; numpy;其他?).


卸载和重新调整numpy(使用pip)没有帮助.

是不是以某种方式让我最近将matplotlib更新为"太新"一个版本,蹩脚的numpy滞后版本?


sys.path是:

['',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',  
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',  
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',  
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',  
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',  
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',  
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',  
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',  
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', 
'/Library/Python/2.7/site-packages']
Run Code Online (Sandbox Code Playgroud)

并且Scypi堆栈安装在site-packages由pip维护的位置.OS X 10.9,Apple Python 2.7.5,所有软件包版本都是由PiPy中的pip发现的.

oro*_*ome 5

强制重新安装在这种情况下有效,因为在类似的情况下它通常会这样做:

sudo pip install -U --force-reinstall scipy
Run Code Online (Sandbox Code Playgroud)