matplotlib在Windows上打破了Python 2.7.3中的str()



下面是ippython中这个问题的示例。这在我尝试过的所有其他Python shell中都可以重现。

In [1]: a = 1e-6
In [2]: str(a)
Out[2]: '1e-06'
In [3]: import matplotlib as mpl
In [4]: str(a)
Out[4]: '1e-06'
In [5]: import matplotlib.pyplot as plt
In [6]: str(a)
Out[6]: '1e-06'
In [7]: plt.plot(1.0)
Out[7]: [<matplotlib.lines.Line2D at 0x262a850>]
In [8]: str(a)
Out[8]: '1e-06'
In [9]: plt.show()
In [10]: str(a)
Out[10]: 'ERR'

这里是相关的版本号。

In [11]: mpl.__version__
Out[11]: '1.2.0'
In [12]: import numpy as np
In [13]: np.__version__
Out[13]: '1.6.2'

这是发生在我的XP专业实验室计算机运行Python 2.7.3和微软Visual Express 2008 c++和Basic。我不知道如何开始追查这个问题。

Enthought回答了这个问题。这不是最令人满意的解决方案,但我不能证明花几天时间试图追踪上述问题的根源是合理的。

最新更新