2013-05-14 73 views
0
Traceback (most recent call last): 
    File "PSPsolver1.py", line 520, in getchain 
    Publisher().sendMessage(("show.mainframe"), msg) 
    File "/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/lib/pubsub/pubsub1 /pub.py", line 750, in sendMessage 
    self.__topicTree.sendMessage(aTopic, message, onTopicNeverCreated) 
    File "/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/lib/pubsub/pubsub1/pub.py", line 423, in sendMessage 
deliveryCount += node.sendMessage(message) 
    File "/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/lib/pubsub/pubsub1/pub.py", line 261, in sendMessage 
listener(message) 
    File "PSPsolver1.py", line 1112, in showFrame 
createfigure() 
    File "PSPsolver1.py", line 927, in createfigure 
x_ax.imshow(xcolors, cmap=cmap, interpolation='none') 
    File "/usr/lib/pymodules/python2.7/matplotlib/axes.py", line 6749, in imshow 
filterrad=filterrad, resample=resample, **kwargs) 
    File "/usr/lib/pymodules/python2.7/matplotlib/image.py", line 547, in __init__ 
**kwargs 
    File "/usr/lib/pymodules/python2.7/matplotlib/image.py", line 94, in __init__ 
    self.set_interpolation(interpolation) 
    File "/usr/lib/pymodules/python2.7/matplotlib/image.py", line 458, in set_interpolation 
raise ValueError('Illegal interpolation string') 
ValueError: Illegal interpolation string 

我有matplotlib 麻煩我有一段代碼,正在一臺計算機上,但是當我嘗試到另一臺計算機上運行它,它似乎並沒有工作,我得到這個錯誤 任何建議在做什麼?麻煩matplotlib發佈訂閱蟒蛇

回答

1

您的代碼上的PSPsolver1.py 927線採用

x_ax.imshow(xcolors, cmap=cmap, interpolation='none') 

。參數interpolation='none'在某個時候推出matplotlib版本1.0.1和1.2.0之間。

所以我的猜測是,你的兩臺機器運行不同版本matplotlib的,並且一個版本並不是最新的。


解決此問題的一種方法是(當然)更新舊版本的matplotlib。如果這是不是一種選擇,或者你不想這樣做,那麼請注意,the docs say

如果插值是「無」,則在 AGG的,PS和PDF後端進行無插值。其他後端將回落到「最近」。

所以,如果你不使用Aggpspdf後端,您可以將行更改爲

x_ax.imshow(xcolors, cmap=cmap, interpolation='nearest') 

當然,如果你走這條路線,有可能是其他代碼段也使用新matplotlib功能。他們可能不那麼容易解決。