本文介绍了导入错误:DLL 加载失败:%1 不是 Python Matplotlib 的有效 Win32 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

>>>从 matplotlib 导入 pyplot 作为 plt回溯(最近一次调用最后一次):文件<pyshell#4>",第 1 行,在 <module> 中从 matplotlib 导入 pyplot 作为 plt文件C:Python27libsite-packagesmatplotlibpyplot.py",第 24 行,在 <module>导入 matplotlib.colorbar文件C:Python27libsite-packagesmatplotlibcolorbar.py",第 27 行,在 <module>导入 matplotlib.artist 作为 martist文件C:Python27libsite-packagesmatplotlibartist.py",第 8 行,在 <module>从转换导入 Bbox、IdentityTransform、TransformedBbox、文件C:Python27libsite-packagesmatplotlibransforms.py",第 35 行,在 <module>从 matplotlib._path 导入 (affine_transform, count_bboxes_overlapping_bbox,导入错误:DLL 加载失败:%1 不是有效的 Win32 应用程序.

我收到此错误.我尝试了 activepythonpython xy,但错误仍然存​​在.

解决方案

你得到的错误是因为你安装了错误的matplotlib组件(有32 位和 64 位组件).

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

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

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

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

  • 您有一个 32 位系统,但您已经安装了 matplotlib
  • 的 64 位组件
  • 您有一个 64 位系统,但您已经安装了 matplotlib
  • 的 32 位组件
  • 您有一个 32 位系统,但您已经安装了 Python 本身的 64 位组件
  • 您有一个 64 位系统,但您已经安装了 Python 本身的 32 位组件

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

要检查您安装了哪个版本的python,请参阅关于堆栈溢出中的这个问题

>>> 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:Python27libsite-packagesmatplotlibpyplot.py", line 24, in <module>
    import matplotlib.colorbar
  File "C:Python27libsite-packagesmatplotlibcolorbar.py", line 27, in <module>
    import matplotlib.artist as martist
  File "C:Python27libsite-packagesmatplotlibartist.py", line 8, in <module>
    from transforms import Bbox, IdentityTransform, TransformedBbox,
  File "C:Python27libsite-packagesmatplotlib	ransforms.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.

I am getting this error.I have tried activepython, python xy, but the error still persists.

解决方案

The error that you are getting is because you have installed the wrong component of matplotlib (there are the 32 bit and 64 bit components).

This page provides you all binaries (32bit,64bit) for Windows. It also includes other packages apart from matplotlib if you may be needing them in the future.

Try installing the proper version for your computer and it should work.

Also don't forget to check whether the Python version you are using is suitable for your computer (32bit or 64bit)

So the problem you are facing is one of these:

  • You have a 32 bit system, but you have installed the 64 bit component of matplotlib
  • You have a 64 bit system, but you have installed the 32 bit component of matplotlib
  • You have a 32 bit system, but you have installed the 64 bit component of Python itself
  • You have a 64 bit system, but you have installed the 32 but component of Python itself

If you are not sure about how your computer's processor handles information, please check THIS WEBSITE

To check which version of python you have installed, refer TO THIS QUESTION IN STACKOVERFLOW

这篇关于导入错误:DLL 加载失败:%1 不是 Python Matplotlib 的有效 Win32 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 16:00