ImportError:DLL加载失败:%1不是Python Matplotlib的有效Win32应用程序

RAM*_*DDY 8 python matplotlib python-2.x python-2.7

>>> from matplotlib import pyplot as plt

Traceback (most recent call last):
  File "<pyshell#4>", line 1, in <module>
    from matplotlib import pyplot as plt
  File "C:\Python27\lib\site-packages\matplotlib\pyplot.py", line 24, in <module>
    import matplotlib.colorbar
  File "C:\Python27\lib\site-packages\matplotlib\colorbar.py", line 27, in <module>
    import matplotlib.artist as martist
  File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 8, in <module>
    from transforms import Bbox, IdentityTransform, TransformedBbox, \
  File "C:\Python27\lib\site-packages\matplotlib\transforms.py", line 35, in <module>
    from matplotlib._path import (affine_transform, count_bboxes_overlapping_bbox,
ImportError: DLL load failed: %1 is not a valid Win32 application.
Run Code Online (Sandbox Code Playgroud)

我收到了这个错误.我试过了activepython,python xy但错误仍然存​​在.

The*_*tor 12

您得到的错误是因为您安装了错误的()组件.matplotlib there are the 32 bit and 64 bit components

此页面为您提供Windows的所有二进制文件(32位,64位).如果您将来可能需要它们,它还包括除matplotlib之外的其他软件包.

尝试为您的计算机安装正确的版本,它应该工作.

另外,不要忘记检查您使用的Python版本是否适合您的计算机(32位或64位)

所以你面临的问题是其中之一:

  • 你有一个32位系统,但你已经安装了64位组件 matplotlib
  • 你有一个64位系统,但你已经安装了32位组件 matplotlib
  • 你有一个32位系统,但你已经安装了Python自己的64位组件
  • 你有一个64位系统,但你已经安装了32但Python它自己的组件

如果您不确定计算机的处理器如何处理信息,请查看本网站

要检查已安装的python版本,请参阅STACKOVERFLOW中的本问题