2013-05-14 70 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功能。他们可能不那么容易解决。