Python 导入错误:DLL 加载失败:找不到指定的模块
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20201868/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ImportError: DLL load failed: The specified module could not be found
提问by DesaiM
I have installed Python 2.5.4, Numpy 1.5.0 win32, Matplotlib 1.0.0 win32, pywin32 218. Still not able to plot graphs in Python. Here is the error I am getting :
我已经安装了 Python 2.5.4、Numpy 1.5.0 win32、Matplotlib 1.0.0 win32、pywin32 218。仍然无法在 Python 中绘制图形。这是我得到的错误:
import pylab
File "C:\Python25\lib\site-packages\pylab.py", line 1, in <module>
from matplotlib.pylab import *
File "C:\Python25\lib\site-packages\matplotlib\pylab.py", line 216, in <module>
from matplotlib import mpl # pulls in most modules
File "C:\Python25\lib\site-packages\matplotlib\mpl.py", line 1, in <module>
from matplotlib import artist
File "C:\Python25\lib\site-packages\matplotlib\artist.py", line 6, in <module>
from transforms import Bbox, IdentityTransform, TransformedBbox, TransformedPath
File "C:\Python25\lib\site-packages\matplotlib\transforms.py", line 34, in <module>
from matplotlib._path import affine_transform
ImportError: DLL load failed: The specified module could not be found.
Please kindly help..
请帮助..
采纳答案by DesaiM
(I found this answer from a video: http://www.youtube.com/watch?v=xmvRF7koJ5E)
(我从视频中找到了这个答案:http: //www.youtube.com/watch?v=xmvRF7koJ5E)
Download
msvcp71.dllandmsvcr71.dllfrom the web.Save them to your
C:\Windows\System32folder.Save them to your
C:\Windows\SysWOW64folder as well (if you have a 64-bit operating system).
从网上下载
msvcp71.dll和下载msvcr71.dll。将它们保存到您的
C:\Windows\System32文件夹中。也将它们保存到您的
C:\Windows\SysWOW64文件夹中(如果您有 64 位操作系统)。
Now try running your code file in Python and it will load the graph in couple of seconds.
现在尝试在 Python 中运行您的代码文件,它会在几秒钟内加载图形。
回答by vGuMuS
To make it short, it means that you lacked some "dependencies" for the libraries you wanted to use. Before trying to use any kind of library, first it is suggested to look up whether it needs another library in python "family". What do I mean?
简而言之,这意味着您缺少要使用的库的一些“依赖项”。在尝试使用任何类型的库之前,首先建议在python“family”中查找是否需要其他库。我是什么意思?
Downloading "dlls" is something that I avoid. I had the same problem with another library "kivy". The problem occurred when I wanted to use Python 3.4v instead of 3.5 Everything was working correctly in 3.5 but I just wanted to use the stable version for kivy which is 3.4 as they officially "advise". So, I switched to 3.4 but then I had the very same "dll" error saying lots of things are missing. So I checked the website and learned that I needed to install extra "dependencies" from the official website of kivy, then the problem got solved.
我避免下载“dll”。我在另一个图书馆“kivy”上遇到了同样的问题。当我想使用 Python 3.4v 而不是 3.5 时出现了问题。在 3.5 中一切正常,但我只想使用 kivy 的稳定版本,即 3.4,因为他们正式“建议”。所以,我切换到 3.4,但后来我遇到了同样的“dll”错误,说很多东西都丢失了。于是查了一下官网,从kivy官网了解到需要安装额外的“依赖”,问题就解决了。
回答by Fabian Polles
I had the same issue with importing matplotlib.pylab with Python 3.5.1 on Win 64. Installing the Visual C++ Redistributable für Visual Studio 2015 from this links: https://www.microsoft.com/en-us/download/details.aspx?id=48145fixed the missing DLLs.
我在 Win 64 上使用 Python 3.5.1 导入 matplotlib.pylab 时遇到了同样的问题。从以下链接安装 Visual C++ Redistributable für Visual Studio 2015:https: //www.microsoft.com/en-us/download/details。 aspx?id=48145修复了丢失的 DLL。
I find it better and easier than downloading and pasting DLLs.
我发现它比下载和粘贴 DLL 更好、更容易。
回答by Dash_bi
Quick note:Check if you have other Python versions, if you have removed them, make sure you did that right. If you have Miniconda on your system then Python will not be removed easily.
快速说明:检查您是否有其他 Python 版本,如果您已删除它们,请确保您做对了。如果您的系统上有 Miniconda,那么 Python 将不会被轻易删除。
What worked for me:removed other Python versions and the Miniconda, reinstalled Python and the matplotlib library and everything worked great.
对我有用的方法:删除其他 Python 版本和 Miniconda,重新安装 Python 和 matplotlib 库,一切都很好。
回答by 4Oh4
Installing the Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019worked for me with a similar problem, and helped with another (slightly different) driver issue.
为 Visual Studio 2015、2017 和 2019安装Microsoft Visual C++ Redistributable 为我解决了类似的问题,并帮助解决了另一个(略有不同的)驱动程序问题。

