首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法导入jupyter笔记本中的包

无法导入jupyter笔记本中的包
EN

Stack Overflow用户
提问于 2018-11-27 02:05:29
回答 1查看 254关注 0票数 0
代码语言:javascript
复制
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import os
from glob import glob
import seaborn as sns
from PIL import Image
np.random.seed(123)
from sklearn.preprocessing import label_binarize
from sklearn.metrics import confusion_matrix
import itertools

import keras
from keras.utils.np_utils import to_categorical # used for converting labels to one-hot-encoding
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten, Conv2D, MaxPool2D
from keras import backend as K
import itertools
from keras.layers.normalization import BatchNormalization
from keras.utils.np_utils import to_categorical # convert to one-hot-encoding

from keras.optimizers import Adam
from keras.preprocessing.image import ImageDataGenerator
from keras.callbacks import ReduceLROnPlateau
from sklearn.model_selection import train_test_split

当我将tensorflow下载到anaconda时,出现了这个错误。我不知道为什么会出现这个错误,有人能帮我吗?因为我是anaconda的新手。这个代码是从kaggle复制的,它的链接是https://www.kaggle.com/sid321axn/step-wise-approach-cnn-model-77-0344-accuracy,但我不知道为什么我会遇到这个错误。

代码语言:javascript
复制
ImportError                               Traceback (most recent call last)
<ipython-input-1-36803f80ec4f> in <module>
----> 1 get_ipython().run_line_magic('matplotlib', 'inline')
      2 import matplotlib.pyplot as plt
      3 import numpy as np
      4 import pandas as pd
      5 import os

~\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2285                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2286             with self.builtin_trap:
-> 2287                 result = fn(*args,**kwargs)
   2288             return result
   2289 

<decorator-gen-108> in matplotlib(self, line)

~\Anaconda3\lib\site-packages\IPython\core\magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

~\Anaconda3\lib\site-packages\IPython\core\magics\pylab.py in matplotlib(self, line)
     97             print("Available matplotlib backends: %s" % backends_list)
     98         else:
---> 99             gui, backend = self.shell.enable_matplotlib(args.gui)
    100             self._show_matplotlib_backend(args.gui, backend)
    101 

~\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py in enable_matplotlib(self, gui)
   3353                 gui, backend = pt.find_gui_and_backend(self.pylab_gui_select)
   3354 
-> 3355         pt.activate_matplotlib(backend)
   3356         pt.configure_inline_support(self, backend)
   3357 

~\Anaconda3\lib\site-packages\IPython\core\pylabtools.py in activate_matplotlib(backend)
    311     matplotlib.rcParams['backend'] = backend
    312 
--> 313     import matplotlib.pyplot
    314     matplotlib.pyplot.switch_backend(backend)
    315 

~\Anaconda3\lib\site-packages\matplotlib\pyplot.py in <module>
     29 from cycler import cycler
     30 import matplotlib
---> 31 import matplotlib.colorbar
     32 from matplotlib import style
     33 from matplotlib import _pylab_helpers, interactive

~\Anaconda3\lib\site-packages\matplotlib\colorbar.py in <module>
     30 
     31 import matplotlib as mpl
---> 32 import matplotlib.artist as martist
     33 import matplotlib.cbook as cbook
     34 import matplotlib.collections as collections

~\Anaconda3\lib\site-packages\matplotlib\artist.py in <module>
     14 import matplotlib
     15 from . import cbook, docstring, rcParams
---> 16 from .path import Path
     17 from .transforms import (Bbox, IdentityTransform, Transform, TransformedBbox,
     18                          TransformedPatchPath, TransformedPath)

~\Anaconda3\lib\site-packages\matplotlib\path.py in <module>
     19 import numpy as np
     20 
---> 21 from . import _path, rcParams
     22 from .cbook import (_to_unmasked_float_array, simple_linear_interpolation,
     23                     maxdict)

ImportError: cannot import name '_path'
EN

回答 1

Stack Overflow用户

发布于 2018-11-27 04:51:26

检查您的环境。代码运行得很好。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53486713

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档