2012-07-22 86 views
2

所以我下載並安裝了matplotlib。奇怪的是,我可以在將它們放置在home/user/Desktop中時正確運行示例,但是當我將它們移動到home/user/Documents時,它們停止工作,並收到以下消息。有什麼特別的關於他們阻止matplotlib導入的Documents文件夾?在Ubuntu上導入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' 

回答

6

你有一個文件new.pyDocuments文件夾中,以任何機會呢?如果有,請嘗試將其重命名爲其他內容。

的matplotlib模塊axes.py進口new,如果你有一個文件new.py Documents文件夾中躺在附近,這將導致Python來代替加載它的內置new模塊。