彻底删除Jupyter

问题描述 投票:2回答:3

我尝试安装jupyter,但不知何故,它无法与matplotlib一起使用3D图形。我总是遇到以下错误:


AttributeError                            Traceback (most recent call last)
<ipython-input-1-dd74dfec8882> in <module>()
      9 
     10 fig = plt.figure()
---> 11 ax = fig.gca(projection='3d')
     12 X, Y, Z = axes3d.get_test_data(0.05)
     13 ax.plot_surface(X, Y, Z, rstride=8, cstride=8, alpha=0.3)

/usr/local/lib/python2.7/dist-packages/matplotlib/figure.pyc in gca(self, **kwargs)
   1272 
   1273         # no axes found, so create one which spans the figure
-> 1274         return self.add_subplot(1, 1, 1, **kwargs)
   1275 
   1276     def sca(self, a):

/usr/local/lib/python2.7/dist-packages/matplotlib/figure.pyc in add_subplot(self, *args, **kwargs)
    962                     self._axstack.remove(ax)
    963 
--> 964             a = subplot_class_factory(projection_class)(self, *args, **kwargs)
    965 
    966         self._axstack.add(key, a)

/usr/local/lib/python2.7/dist-packages/matplotlib/axes/_subplots.pyc in __init__(self, fig, *args, **kwargs)
     76 
     77         # _axes_class is set in the subplot_class_factory
---> 78         self._axes_class.__init__(self, fig, self.figbox, **kwargs)
     79 
     80     def __reduce__(self):

/usr/lib/pymodules/python2.7/mpl_toolkits/mplot3d/axes3d.pyc in __init__(self, fig, rect, *args, **kwargs)
     89         Axes.__init__(self, fig, rect,
     90                       frameon=True,
---> 91                       *args, **kwargs)
     92         # Disable drawing of axes by base class
     93         Axes.set_axis_off(self)

/usr/local/lib/python2.7/dist-packages/matplotlib/axes/_base.pyc in __init__(self, fig, rect, axisbg, frameon, sharex, sharey, label, xscale, yscale, **kwargs)
    435         self._hold = rcParams['axes.hold']
    436         self._connected = {}  # a dict from events to (id, func)
--> 437         self.cla()
    438         # funcs used to format x and y - fall back on major formatters
    439         self.fmt_xdata = None

/usr/lib/pymodules/python2.7/mpl_toolkits/mplot3d/axes3d.pyc in cla(self)
   1043         self._zmargin = 0
   1044 
-> 1045         Axes.cla(self)
   1046 
   1047         self.grid(rcParams['axes3d.grid'])

/usr/local/lib/python2.7/dist-packages/matplotlib/axes/_base.pyc in cla(self)
    906         self.containers = []
    907 
--> 908         self.grid(self._gridOn, which=rcParams['axes.grid.which'])
    909         props = font_manager.FontProperties(size=rcParams['axes.titlesize'],
    910                                         weight=rcParams['axes.titleweight'])

/usr/lib/pymodules/python2.7/mpl_toolkits/mplot3d/axes3d.pyc in grid(self, b, **kwargs)
   1254         if len(kwargs) :
   1255             b = True
-> 1256         self._draw_grid = maxes._string_to_bool(b)
   1257 
   1258     def ticklabel_format(self, **kwargs) :

AttributeError: 'module' object has no attribute '_string_to_bool'             

这在我安装Jupyter之前没有发生过,所以我认为删除Jupyter会有所帮助。我跑了

pip uninstall jupyter

并且还删除主目录中的.ipython.jupyter中的目录,但每当我运行时

ipython notebook 

Jupyter布局仍然存在,我仍然得到相同的错误...我甚至尝试卸载并再次安装ipythonipython-notebook但它仍然无法正常工作。

有什么建议?我真的不太了解内核......

非常感谢。

ipython ipython-notebook jupyter
3个回答
0
投票

看起来像matplotlib的apt包的问题。之后我做了apt-get purge matplotlibapt-get autoremove matplotlib,接着是pip install matplotlib,它的确有效。

谢谢,


0
投票

如果您使用的是Aniponda安装的Scipy,您可以使用conda update matplotlib。这导致我更新python,matplotlib,numpy和其他一些软件包。然后Matplotlib可以导入并正常工作。我不必以这种方式卸载任何东西。 Jupyter继续工作。


0
投票

运行pip uninstall jupyter并删除主目录中的.ipython和.jupyter中的目录

jupyter --path

然后删除路径上的所有内容

并小心删除python安装目录中的脚本{仅删除jupyter文件}

最后你将没有jupyter

© www.soinside.com 2019 - 2024. All rights reserved.