简体   繁体   English

导入Matplotlib.pyplot:DLL加载失败

[英]Importing Matplotlib.pyplot: DLL load failed

When trying to import matplotlib.pyplot (in Spyder), I get the following error(s): 尝试导入matplotlib.pyplot(在Spyder中)时,出现以下错误:

Python 3.5.1 |Anaconda 2.5.0 (64-bit)| (default, Jan 29 2016, 15:01:46) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sympy as sp
>>> import numpy as np
>>> import matplotlib.pyplot as plt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\...\Anaconda3_1\lib\site-packages\matplotlib\pyplot.py", line 36, in <module>
    from matplotlib.figure import Figure, figaspect
  File "C:\Users\...\Anaconda3_1\lib\site-packages\matplotlib\figure.py", line 35, in <module>
    from matplotlib import _image
ImportError: DLL load failed: Operation did not complete successfully because the file contains a virus or potentially unwanted software.

If I try to import it again, I get the following: 如果尝试再次导入,则会得到以下信息:

>>> import matplotlib.pyplot as plt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\...\Anaconda3_1\lib\site-packages\matplotlib\pyplot.py", line 36, in <module>
    from matplotlib.figure import Figure, figaspect
  File "C:\Users\...\Anaconda3_1\lib\site-packages\matplotlib\figure.py", line 35, in <module>
    from matplotlib import _image
  File "C:\Users\...\Anaconda3_1\lib\site-packages\matplotlib\_image.py", line 7, in <module>
    __bootstrap__()
  File "C:\Users\...\Anaconda3_1\lib\site-packages\matplotlib\_image.py", line 6, in __bootstrap__
    imp.load_dynamic(__name__,__file__)
  File "C:\Users\...\Anaconda3_1\lib\imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: The specified module could not be found.

My version of Python is the following: 我的Python版本如下:

Python 3.5.1 |Anaconda 2.5.0 (64-bit)| (default, Jan 29 2016, 15:01:46) [MSC v.1900 64 bit (AMD64)] 

I'm guessing this is a false positive by my antivirus (Avast), though I still get the second error after turning it off. 我猜测这是我的防病毒软件(Avast)的误报,尽管我将其关闭后仍然遇到第二个错误。 Reinstalling the module or Anaconda did not work either. 重新安装模块或Anaconda均无效。

Is it possible that my antivirus keeps deleting the DLL, and if so, is there a way to stop it from doing so? 我的防病毒软件可能会不断删除DLL,如果这样,是否有阻止它删除的方法? Or is my problem something else entirely? 还是我的问题完全是其他问题?

Many thanks! 非常感谢!

I had this exact same problem with Avast and matplotlib. 我在Avast和matplotlib中遇到了完全相同的问题。 My solution was to uninstall Anaconda, then reinstall the same version and add C:\\Anaconda3 to the excepted scan directory in Avast. 我的解决方案是卸载Anaconda,然后重新安装相同版本,并将C:\\ Anaconda3添加到Avast中的例外扫描目录中。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM