在Ubuntu上导入matplotlib

ump*_*mps 2 python ubuntu matplotlib

所以我下载并安装了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'
Run Code Online (Sandbox Code Playgroud)

Luk*_*ard 6

你有一个文件,new.py你的Documents文件夹,通过任何机会呢?如果有,请尝试将其重命名为其他内容.

matplotlib模块axes.py导入new,如果你new.py的Documents文件夹中有一个文件,那将导致Python加载它而不是内置new模块.