简体   繁体   中英

Importing Matplotlib.pyplot: DLL load failed

When trying to import matplotlib.pyplot (in Spyder), I get the following error(s):

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 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. Reinstalling the module or Anaconda did not work either.

Is it possible that my antivirus keeps deleting the DLL, and if so, is there a way to stop it from doing so? Or is my problem something else entirely?

Many thanks!

I had this exact same problem with Avast and matplotlib. My solution was to uninstall Anaconda, then reinstall the same version and add C:\\Anaconda3 to the excepted scan directory in Avast.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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