3

当我尝试从 scipy.stats 导入 pearsonr 时出现此错误。

from scipy.stats import pearsonr

错误显示:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/scipy/stats/__init__.py", line 7, in <module>
from stats import *
File "/usr/lib/python2.7/dist-packages/scipy/stats/stats.py", line 198, in <module>
import distributions
File "/usr/lib/python2.7/dist-packages/scipy/stats/distributions.py", line 87, in <module>
from new import instancemethod
File "new.py", line 2, in <module>
import matplotlib.pyplot as plt
File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 23, in <module>
from matplotlib.figure import Figure, figaspect
File "/usr/lib/pymodules/python2.7/matplotlib/figure.py", line 18, in <module>
from axes import Axes, SubplotBase, subplot_class_factory
File "/usr/lib/pymodules/python2.7/matplotlib/axes.py", line 8537, in <module>
Subplot = subplot_class_factory()
File "/usr/lib/pymodules/python2.7/matplotlib/axes.py", line 8529, in subplot_class_factory
new_class = new.classobj("%sSubplot" % (axes_class.__name__),
AttributeError: 'module' object has no attribute 'classobj'

有什么解决办法???

4

1 回答 1

0

您可能有一个正在导入的 new.py 文件而不是所需的文件。

于 2014-02-25T15:03:19.803 回答