当我尝试导入子模块pyplot时:
import matplotlib.pyplot as plt
我收到以下错误:
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。有什么想法吗?
答案 0 :(得分:0)
它不在模块的python搜索路径中。
请参阅模块教程中的第6.1.2节:https://docs.python.org/2/tutorial/modules.html
基本上,您需要将安装dll的目录添加到库搜索路径。