我试图使用mplot3d来绘制3D内容。我有Mac OSX。但是我收到了这个错误:
ax = fig.gca(projection = '3d')
File "/usr/local/lib/python2.7/site-packages/matplotlib/figure.py", line 1368, in gca
return self.add_subplot(1, 1, 1, **kwargs)
File "/usr/local/lib/python2.7/site-packages/matplotlib/figure.py", line 1020, in add_subplot
a = subplot_class_factory(projection_class)(self, *args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/matplotlib/axes/_subplots.py", line 73, in __init__
self._axes_class.__init__(self, fig, self.figbox, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.py", line 91, in __init__
*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/matplotlib/axes/_base.py", line 551, in __init__
self.cla()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.py", line 1045, in cla
Axes.cla(self)
File "/usr/local/lib/python2.7/site-packages/matplotlib/axes/_base.py", line 1062, in cla
self.grid(False) # Disable grid on init to use rcParameter
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.py", line 1256, in grid
self._draw_grid = maxes._string_to_bool(b)
AttributeError: 'module' object has no attribute '_string_to_bool'
我在这里搜索了这个问题并尝试了一堆解决方案。我正在使用matplotlib 2.0.0:
这两项都不起作用,我仍然遇到同样的错误。有什么建议?谢谢!