简体   繁体   中英

iPython matplotlib.pyplot

When I try to import submodule pyplot:

import matplotlib.pyplot as plt

I get following error:

ImportError                               Traceback (most recent call last)

<ipython-input-21-eff513f636fd> in <module>()
----> 1 import matplotlib.pyplot as plt

C:\Anaconda3\lib\site-packages\matplotlib\pyplot.py in <module>()
     27 from cycler import cycler
     28 import matplotlib
---> 29 import matplotlib.colorbar
     30 from matplotlib import style
     31 from matplotlib import _pylab_helpers, interactive

C:\Anaconda3\lib\site-packages\matplotlib\colorbar.py in <module>()
     32 import matplotlib.artist as martist
     33 import matplotlib.cbook as cbook
---> 34 import matplotlib.collections as collections
     35 import matplotlib.colors as colors
     36 import matplotlib.contour as contour

C:\Anaconda3\lib\site-packages\matplotlib\collections.py in <module>()
     25 import matplotlib.artist as artist
     26 from matplotlib.artist import allow_rasterization
---> 27 import matplotlib.backend_bases as backend_bases
     28 import matplotlib.path as mpath
     29 from matplotlib import _path

C:\Anaconda3\lib\site-packages\matplotlib\backend_bases.py in <module>()
     60 
     61 import matplotlib.tight_bbox as tight_bbox
---> 62 import matplotlib.textpath as textpath
     63 from matplotlib.path import Path
     64 from matplotlib.cbook import mplDeprecation, warn_deprecated

C:\Anaconda3\lib\site-packages\matplotlib\textpath.py in <module>()
     16 from matplotlib.ft2font import FT2Font, KERNING_DEFAULT, LOAD_NO_HINTING
     17 from matplotlib.ft2font import LOAD_TARGET_LIGHT
---> 18 from matplotlib.mathtext import MathTextParser
     19 import matplotlib.dviread as dviread
     20 from matplotlib.font_manager import FontProperties

C:\Anaconda3\lib\site-packages\matplotlib\mathtext.py in <module>()
     58 
     59 import matplotlib.colors as mcolors
---> 60 import matplotlib._png as _png
     61 ####################
     62 

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

Matplotlib is installed. Any ideas?

It's not in your python search path for modules.

See section 6.1.2 in the tutorial on modules: https://docs.python.org/2/tutorial/modules.html

Basically, you need to add the directory where the dll is installed to the library search path.

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