安装基础:PyAssertion错误

时间:2017-06-19 16:10:30

标签: python canopy

    %pylab
    x = linspace(-10., 10., 1000)
    plot(x, sin(x))
PyAssertionError                          Traceback (most recent call last)
<ipython-input-41-c9b44dd20001> in <module>()
----> 1 plot(x, sin(x))

C:\Users\RD\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\pyplot.pyc in plot(*args, **kwargs)
   3305 @_autogen_docstring(Axes.plot)
   3306 def plot(*args, **kwargs):
-> 3307     ax = gca()
   3308     # Deprecated: allow callers to override the hold state
   3309     # by passing hold=True|False

C:\Users\RD\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\pyplot.pyc in gca(**kwargs)
    948     matplotlib.figure.Figure.gca : The figure's gca method.
    949     """
--> 950     return gcf().gca(**kwargs)
    951 
    952 # More ways of creating axes:

C:\Users\RD\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\pyplot.pyc in gcf()
    584         return figManager.canvas.figure
    585     else:
--> 586         return figure()
    587 
    588 


C:\Users\RD\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\pyplot.pyc in figure(num, figsize, dpi, facecolor, edgecolor, frameon, FigureClass, **kwargs)
    533                                         frameon=frameon,
    534                                         FigureClass=FigureClass,
--> 535                                         **kwargs)
    536 
    537         if figLabel:

C:\Users\RD\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\backends\backend_wxagg.pyc in new_figure_manager(num, *args, **kwargs)
    114     fig = FigureClass(*args, **kwargs)
    115 
--> 116     return new_figure_manager_given_figure(num, fig)
    117 
    118 

C:\Users\RD\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\backends\backend_wxagg.pyc in new_figure_manager_given_figure(num, figure)
    121     Create a new figure manager instance for the given figure.
    122     """
--> 123     frame = FigureFrameWxAgg(num, figure)
    124     figmgr = frame.get_figure_manager()
    125     if matplotlib.is_interactive():

C:\Users\RD\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\backends\backend_wx.pyc in __init__(self, num, fig)
   1262         # of the frame - so appearance is closer to GTK version
   1263 
-> 1264         self.toolbar = self._get_toolbar(statbar)
   1265 
   1266         if self.toolbar is not None:

C:\Users\RD\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\backends\backend_wxagg.pyc in _get_toolbar(self, statbar)
     26     def _get_toolbar(self, statbar):
     27         if matplotlib.rcParams['toolbar'] == 'toolbar2':
---> 28             toolbar = NavigationToolbar2WxAgg(self.canvas)
     29             toolbar.set_status_bar(statbar)
     30         else:

C:\Users\RD\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\backends\backend_wx.pyc in __init__(self, canvas)
   1569     def __init__(self, canvas):
   1570         wx.ToolBar.__init__(self, canvas.GetParent(), -1)
-> 1571         NavigationToolbar2.__init__(self, canvas)
   1572         self.canvas = canvas
   1573         self._idle = True

C:\Users\RD\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\backend_bases.pyc in __init__(self, canvas)
   2750         self._active = None
   2751         self._lastCursor = None
-> 2752         self._init_toolbar()
   2753         self._idDrag = self.canvas.mpl_connect(
   2754             'motion_notify_event', self.mouse_move)

C:\Users\RD\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\backends\backend_wx.pyc in _init_toolbar(self)
   1595             self.wx_ids[text] = wx.NewId()
   1596             wxc._AddTool(self, self.wx_ids, text,
-> 1597                         _load_bitmap(image_file + '.png'),
   1598                         tooltip_text)
   1599 

C:\Users\RD\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\backends\backend_wx.pyc in _load_bitmap(filename)
   1423         raise IOError('Could not find bitmap file "%s"; dying' % bmpFilename)
   1424 
-> 1425     bmp = wx.Bitmap(bmpFilename)
   1426     return bmp
   1427 

C:\Users\RD\AppData\Local\Enthought\Canopy\User\lib\site-packages\wx\_gdi.pyc in __init__(self, *args, **kwargs)
    646         Loads a bitmap from a file.
    647         """
--> 648         _gdi_.Bitmap_swiginit(self,_gdi_.new_Bitmap(*args, **kwargs))
    649     __swig_destroy__ = _gdi_.delete_Bitmap
    650     __del__ = lambda self : None;

PyAssertionError: C++ assertion "strcmp(setlocale(LC_ALL, NULL), "C") == 0" failed at ..\..\src\common\intl.cpp(1449) in wxLocale::GetInfo(): You probably called setlocale() directly instead of using wxLocale and now there is a mismatch between C/C++ and Windows locale.
Things are going to break, please only change locale by creating wxLocale objects to avoid this! 

我试图绘制结果。我如何绘制结果?我收到了PyAssertion错误。我该如何解决错误?

0 个答案:

没有答案