简体   繁体   English

ImportError:DLL加载失败:找不到指定的模块。 “matplotlib.pyplot”

[英]ImportError: DLL load failed: The specified module could not be found. “matplotlib.pyplot”

I am using the Anaconda distribution for Windows 10 (Anaconda3 specifically), and I have a large variety of packages installed, relevant packages could be python 3.5.1, numpy 1.10.4, jupyter 1.0.0 (with the client, console, and core packages), matplotlib 1.5.1 (np110py35_0), notebook 4.1.0, and uncertainties 2.4.7.1. 我正在使用Windows 10的Anaconda发行版(专门用于Anaconda3),并且安装了各种各样的软件包,相关的软件包可能是python 3.5.1,numpy 1.10.4,jupyter 1.0.0(以及客户端,控制台和核心套件),matplotlib 1.5.1(np110py35_0),笔记本电脑4.1.0和不确定性2.4.7.1。

When I try to import matplotlib.pyplot this is what I am getting: 当我尝试导入matplotlib.pyplot时,这就是我得到的:

import matplotlib.pyplot as plt
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-eff513f636fd> in <module>()
----> 1 import matplotlib.pyplot as plt

C:\Users\Michael\Anaconda3\lib\site-packages\matplotlib\pyplot.py in <module>()
 34 from matplotlib import docstring
 35 from matplotlib.backend_bases import FigureCanvasBase
---> 36 from matplotlib.figure import Figure, figaspect
 37 from matplotlib.gridspec import GridSpec
 38 from matplotlib.image import imread as _imread

C:\Users\Michael\Anaconda3\lib\site-packages\matplotlib\figure.py in <module>()
 33 from matplotlib.cbook import Stack, iterable
 34 
---> 35 from matplotlib import _image
 36 from matplotlib.image import FigureImage
 37 

C:\Users\Michael\Anaconda3\lib\site-packages\matplotlib\_image.cp35-win_amd64.pyd in <module>()

C:\Users\Michael\Anaconda3\lib\site-packages\matplotlib\_image.cp35-win_amd64.pyd in __bootstrap__()

C:\Users\Michael\Anaconda3\lib\imp.py in load_dynamic(name, path, file)
340         spec = importlib.machinery.ModuleSpec(
341             name=name, loader=loader, origin=path)
--> 342         return _load(spec)
343 
344 else:

ImportError: DLL load failed: The specified module could not be found.

This error occurred while I was working with some data in the jupyter notebook. 当我在jupyter笔记本中处理某些数据时发生此错误。 Upon starting the notebook and importing the modules I needed, the notebook was running just fine. 启动笔记本电脑并导入所需的模块后,笔记本电脑运行正常。 However, at one point the notebook I had been working on had been cluttered with variables, so I decided to restart the kernel via the command bar in the top part of the notebook and run it again (a very normal thing for me to do that I have done multiple times without problems. 但是,有一次,我一直在处理的笔记本上杂乱无章,所以我决定通过笔记本顶部的命令栏重新启动内核,然后再次运行它(对我来说这是很正常的事情)我已经做了很多次而没有问题。

It might be worth noting I was using numpy, matplotlib.pyplot, and the uncertainties package at the time. 可能值得注意的是,我当时使用的是numpy,matplotlib.pyplot和不确定性包。 When I restarted the kernel though, I got that ImportError listed above. 但是,当我重新启动内核时,我得到了上面列出的ImportError。

Before starting the notebook, I used conda update --all (as I usually do), and everything was working normally. 在启动笔记本电脑之前,我使用了conda update --all(就像我通常所做的那样),并且一切正常。 The problem occurred after I had restarted the kernel a few times. 重新启动内核几次后出现了问题。

The solutions I have tried and have had no success with are: 我尝试过但没有成功的解决方案是:

  • restarting the jupyter notebook and loading it again 重新启动jupyter笔记本并再次加载
  • creating a new, clean jupyter notebook (.ipynb file) and attempting to use import matplotlib.pyplot as plt again 创建一个新的干净的jupyter笔记本(.ipynb文件),然后尝试再次将import matplotlib.pyplot用作plt
  • trying to revert to a more stable version of anaconda by using conda update anaconda 试图通过使用conda更新anaconda恢复为anaconda的更稳定版本

I am wary when it comes to re-installing Anaconda by using conda install anaconda, or uninstalling and re-installing matplotlib. 对于使用conda install anaconda或卸载并重新安装matplotlib来重新安装Anaconda的情况,我很警惕。 I am worried it might interfere with some of my other packages, so I wanted to see if there were other options first. 我担心它可能会干扰我的其他一些软件包,所以我想先看看是否有其他选择。

Any help would be appreciated, thank you! 任何帮助,将不胜感激,谢谢!

I had the same problem and unfortunately only reinstalling Anaconda fixed it... For some reason I had to delete the Anaconda3 folder manually before reinstalling in order for it to work. 我遇到了同样的问题,不幸的是,仅重新安装了Anaconda即可解决此问题。由于某种原因,我必须手动删除Anaconda3文件夹,然后才能重新安装才能正常工作。 (simply uninstalling anaconda does not delete the folder) (仅卸载anaconda不会删除该文件夹)

Hope that helps you out, best of luck. 希望能帮到您,祝您好运。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 MeCab:“ ImportError:DLL加载失败:找不到指定的模块。” - MeCab: “ImportError: DLL load failed: The specified module could not be found.” 导入错误:DLL 加载失败:找不到指定的模块。(Keras) - ImportError: DLL load failed: The specified module could not be found.(Keras) MeCab:“ImportError:DLL 加载失败:找不到指定的模块。” - MeCab: “ImportError: DLL load failed: The specified module could not be found.” from matplotlib import ft2font: “ImportError: DLL load failed: The specified procedure could not be found.” - from matplotlib import ft2font: “ImportError: DLL load failed: The specified procedure could not be found.” ImportError:DLL加载失败:找不到指定的过程。蟒蛇 - ImportError: DLL load failed: The specified procedure could not be found. Python ImportError:DLL加载失败:找不到指定的模块。 CV2 - ImportError: DLL load failed: The specified module could not be found. cv2 在pycharm ImportError中:DLL加载失败:找不到指定的模块。 导入人脸识别时 - In pycharm ImportError: DLL load failed: The specified module could not be found. while importing facerecognition 导入错误:DLL 加载失败:找不到指定的模块。 (NASA Fortran CEA 的 Python Rocketcea 包装器) - ImportError: DLL load failed: The specified module could not be found. (Python rocketcea wrapper for NASA Fortran CEA) 如何通过 xlwings 包导入 numpy? “导入错误:DLL 加载失败:找不到指定的模块。” - How to import numpy through xlwings package? "ImportError: DLL load failed: The specified module could not be found." 导入错误:DLL 加载失败:找不到指定的模块。 Tensorflow 聊天机器人 - ImportError: DLL load failed: The specified module could not be found. Tensorflow Chatbot
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM