2013-05-31 33 views
1

我尝试在networkx绘制简单的图表,但出现此错误信息的图表:情节NetworkX

RuntimeError: module compiled against API version 6 but this version of numpy is 4 

Traceback (most recent call last): 
    File "D:\project\awk\gg.py", line 2, in <module> 
    import matplotlib.pyplot as plt 
    File "D:\programs\python\lib\site-packages\matplotlib\pyplot.py", line 26, in <module> 
    from matplotlib.figure import Figure, figaspect 
    File "D:\programs\python\lib\site-packages\matplotlib\figure.py", line 24, in <module> 
    import matplotlib.artist as martist 
    File "D:\programs\python\lib\site-packages\matplotlib\artist.py", line 7, in <module> 
    from transforms import Bbox, IdentityTransform, TransformedBbox, \ 
    File "D:\programs\python\lib\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 

如何解决这个问题?

+1

您可以绘制独立于networkx的简单图吗? – silvado

+0

你可以输入numpy吗? – TheMeaningfulEngineer

+0

请编辑标签以指向正确的Windows版本。 – tacaswell

回答

3

您下载了一个matplotlib的二进制版本,该版本与您安装的较新版本的numpy链接/编译。

要么升级numpy安装,找到对你的numpy版本编译版本的matplotlib,或从源代码构建matplotlib

+0

如何升级numpy? – nilashan

+1

http://stackoverflow.com/questions/11200137/installing-numpy-on-64bit-windows-7-with-python-2-7-3 – tacaswell

1

问题与错误消息中所述的API不匹配有关。首先使用pip卸载numpy。

 pip uninstall numpy 

然后从here得到numpy的和matplotlib最新的二进制安装选择你的Python和Windows 32或64位版本。然后将其安装为正常的软件安装程序。确保它在安装过程中找到你的python版本。就是这个 !!