如何在Python中显示图片

时间:2014-01-29 02:13:44

标签: python

我跑了     easy_install pygame     easy_install xdot 在命令窗口中,它说已经安装了pygame和xdot,但是,当我运行以下代码时,

from coinor.gimpy import Graph
import pygame 

if __name__=='__main__':    
    g = Graph()
    g.add_edge(0,1)
    g.add_edge(1,2)
    g.add_edge(3,4)
    g.set_display_mode('xdot')
    g.display()

它有一些错误:

Error: xdot not installed. Display disabled.

当我将模式xdot更改为pygame时,

Traceback (most recent call last):
  File "E:\Code\Eclipse\IE411HW1\problem1.py", line 11, in <module>
g.display()
  File "E:\learning software\Python\lib\site-packages\coinor.gimpy-1.1.0-py2.7.egg\coinor\gimpy\graph.py", line 1625, in display
im = StringIO.StringIO(self.create(self.get_layout(), format))
  File "E:\learning software\Python\lib\site-packages\coinor.gimpy-1.1.0-py2.7.egg\coinor\gimpy\graph.py", line 1559, in create
stderr=subprocess.PIPE)
  File "E:\learning software\Python\lib\subprocess.py", line 711, in __init__
errread, errwrite)
  File "E:\learning software\Python\lib\subprocess.py", line 948, in _execute_child
startupinfo)
WindowsError: [Error 2] 

我该怎么调试?我工作了几个小时仍然无法弄清楚如何显示图表!谢谢。

1 个答案:

答案 0 :(得分:0)

WindowsError:[错误2]告诉您“系统找不到指定的文件。”

看起来错误是:

from coinor.gimpy import Graph

尝试删除它/检查安装是否存在?