所以我下载并安装了matplotlib。奇怪的是,当它们放置在 home/user/Desktop 中时,我可以很好地运行这些示例,但是当我将它们移动到 home/user/Documents 时,它们停止工作,并且我收到以下消息。 Documents 文件夹是否有什么特殊之处导致 matplotlib 无法导入?
Traceback (most recent call last):
File "contour_manual.py", line 4, in <module>
import matplotlib.pyplot as plt
File "/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 23, in <module>
from matplotlib.figure import Figure, figaspect
File "/usr/local/lib/python2.7/dist-packages/matplotlib/figure.py", line 18, in <module>
from axes import Axes, SubplotBase, subplot_class_factory
File "/usr/local/lib/python2.7/dist-packages/matplotlib/axes.py", line 8454, in <module>
Subplot = subplot_class_factory()
File "/usr/local/lib/python2.7/dist-packages/matplotlib/axes.py", line 8446, in subplot_class_factory
new_class = new.classobj("%sSubplot" % (axes_class.__name__),
AttributeError: 'module' object has no attribute 'classobj'
你有文件吗new.py
在你的Documents
文件夹,有机会吗?如果有,请尝试将其重命名为其他名称。
matplotlib 模块axes.py
进口new
,如果你有一个文件new.py
位于你的 Documents 文件夹中,这将导致 Python 加载它而不是内置的new
module.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)