我在 Mac 上的 Eclipse 中工作。我正在使用 PyDev 版本 2.6.0.2012062818。我有一个运行完美的程序,但是在我将 Lion OS 更新为 Mountain Lion OS 后,运行时出现以下错误:
Traceback (most recent call last):
File "/Users/Mihails/Projects/memsim/src/memsim/memsim.py", line 7, in <module>
from simulation import SimulationHP
File "/Users/Mihails/Projects/memsim/src/memsim/simulation.py", line 9, in <module>
import matplotlib.pyplot as plt
File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/matplotlib/pyplot.py", line 95, in <module>
new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/matplotlib/backends/__init__.py", line 25, in pylab_setup
globals(),locals(),[backend_name])
File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/matplotlib/backends/backend_wxagg.py", line 23, in <module>
import backend_wx # already uses wxversion.ensureMinimal('2.8')
File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/matplotlib/backends/backend_wx.py", line 63, in <module>
backend_version = wx.VERSION_STRING
AttributeError: 'module' object has no attribute 'VERSION_STRING'
我根本不了解 wx 模块。我在站点包中没有 wx 文件夹。我有 wxPython。wxPython init.py 文件:
# The "old" wxPython package
import warnings
warnings.warn(
"The wxPython compatibility package is no longer automatically generated "
"or actively maintained. Please switch to the wx package as soon as possible.",
DeprecationWarning, stacklevel=2)
# We need to be able to import from the wx package, but there is also
# a wxPython.wx module and that would normally be chosen first by
# import statements. So instead we'll have a wxPython._wx module and
# then stuff it into sys.modules with a wxPython.wx alias so old
# programs will still work.
import _wx
import sys
sys.modules['wxPython.wx'] = _wx
wx = _wx
del sys
from wx import __version__