Windows 7中未将matplotlib和seaborn导入到Anaconda jupyter笔记本中

时间:2018-10-25 10:27:25

标签: python matplotlib jupyter-notebook

我今天安装了Anaconda,以便在Windows7 PC上第一次运行python,并打开了Jupyter笔记本文件。 numpy,matplotlib和seaborn似乎都已安装到系统中。我可以在anaconda命令行界面上看到此信息。我能够导入numpy并在Jupyter笔记本上使用numpy数组。但是,当我尝试在木星笔记本上导入matplotlib或seaborn时,会出现以下错误。

---------------------------------------------------------------------------
    ImportError                               Traceback (most recent call last)
    <ipython-input-2-e1e4c6620adb> in <module>
          6 print(abc)
          7 
    ----> 8 import seaborn as sns

    E:\Anaconda3\lib\site-packages\seaborn\__init__.py in <module>
          1 # Capture the original matplotlib rcParams
    ----> 2 import matplotlib as mpl
          3 _orig_rc_params = mpl.rcParams.copy()
          4 
          5 # Import seaborn objects

    E:\Anaconda3\lib\site-packages\matplotlib\__init__.py in <module>
       1109 with warnings.catch_warnings():
       1110     warnings.simplefilter("ignore", MatplotlibDeprecationWarning)
    -> 1111     rcParamsOrig = RcParams(rcParams.copy())
       1112     rcParamsDefault = RcParams([(key, default) for key, (default, converter) in
       1113                                 defaultParams.items()

    E:\Anaconda3\lib\site-packages\matplotlib\__init__.py in __getitem__(self, key)
        889             val = dict.__getitem__(self, key)
        890             if val is rcsetup._auto_backend_sentinel:
    --> 891                 from matplotlib import pyplot as plt
        892                 plt.switch_backend(rcsetup._auto_backend_sentinel)
        893 

    E:\Anaconda3\lib\site-packages\matplotlib\pyplot.py in <module>
         30 from cycler import cycler
         31 import matplotlib
    ---> 32 import matplotlib.colorbar
         33 import matplotlib.image
         34 from matplotlib import rcsetup, style

    E:\Anaconda3\lib\site-packages\matplotlib\colorbar.py in <module>
         38 import matplotlib.transforms as mtransforms
         39 import matplotlib._layoutbox as layoutbox
    ---> 40 import matplotlib._constrained_layout as constrained_layout
         41 from matplotlib import docstring
         42 

    E:\Anaconda3\lib\site-packages\matplotlib\_constrained_layout.py in <module>
         50 import warnings
         51 
    ---> 52 from matplotlib.legend import Legend
         53 import matplotlib.transforms as transforms
         54 import matplotlib._layoutbox as layoutbox

    E:\Anaconda3\lib\site-packages\matplotlib\legend.py in <module>
         41 from matplotlib.transforms import BboxTransformTo, BboxTransformFrom
         42 
    ---> 43 from matplotlib.offsetbox import HPacker, VPacker, TextArea, DrawingArea
         44 from matplotlib.offsetbox import DraggableOffsetBox
         45 

    E:\Anaconda3\lib\site-packages\matplotlib\offsetbox.py in <module>
         31 from matplotlib import docstring
         32 
    ---> 33 from matplotlib.image import BboxImage
         34 
         35 from matplotlib.patches import bbox_artist as mbbox_artist

    E:\Anaconda3\lib\site-packages\matplotlib\image.py in <module>
         17 import matplotlib.artist as martist
         18 from matplotlib.artist import allow_rasterization
    ---> 19 from matplotlib.backend_bases import FigureCanvasBase
         20 import matplotlib.colors as mcolors
         21 import matplotlib.cm as cm

    E:\Anaconda3\lib\site-packages\matplotlib\backend_bases.py in <module>
         44 import numpy as np
         45 
    ---> 46 from matplotlib import (
         47     backend_tools as tools, cbook, colors, textpath, tight_bbox, transforms,
         48     widgets, get_backend, is_interactive, rcParams)

    ImportError: cannot import name 'get_backend' from 'matplotlib' (E:\Anaconda3\lib\site-packages\matplotlib\__init__.py)

0 个答案:

没有答案