我在使用 Spyder 运行 python 程序时遇到了一点问题:这是我的程序:
from PySide.QtGui import QApplication
from pyoppinet.helper.correlation_manager import *
import pyoppinet.network as nt
import numpy as np
from pyoppinet.node import node
from pyoppinet.GUI import network_view as nw
from pyoppinet.pipe.flowline import Flowline
network = nt.PipeLineNetwork(1000.2000)
source1 = node.Source(10,200)
source1.name = 'source1'
source2 = node.Source(150,500)
source2.name = 'source2'
source3 = node.Source(200,400)
source3.name = 'source3'
junction1 =node.Junction(150,600)
junction1.name = 'junction'
sink =node.Sink(300,800)
sink.name = 'sink'
for n in [source1,source2,source3,junction1,sink]:
network.add_node(n)
fl1=Flowline(source1,junction1)
fl2=Flowline(junction1,sink)
fl3=Flowline(source2,sink)
fl4=Flowline(source2,junction1)
fl5=Flowline(source3,sink)
fl6=Flowline(source3,junction1)
for n in [fl1,fl2,fl3,fl4,fl5,fl6]:
network.add_flowline(n)
print [n.name for n in network.get_nodes()]
print 'topological sort', [n.name for n in network.topological_sort()]
a=QApplication([])
view=nw.PipeLineNetworkView(network)
view.show()
a.exec_()
这两行:
from pyoppinet.helper.correlation_manager import *
import numpy as np
是错误的。
错误是:
Traceback (most recent call last):
File "D:\program oppinet\latihan\latihan.py", line 9, in <module>
from pyoppinet.helper.correlation_manager import *
File "D:\program oppinet\pyoppinet\__init__.py", line 1, in <module>
import GUI
File "D:\program oppinet\pyoppinet\GUI\__init__.py", line 7, in <module>
"""
File "D:\program oppinet\pyoppinet\GUI\viewmodelbase.py", line 1, in <module>
File "D:\program oppinet\pyoppinet\GUI\framework\__init__.py", line 3, in <module>
# Copyright © 2011 Pierre Raybaut
File "D:\program oppinet\pyoppinet\GUI\framework\GUI_helper.py", line 1, in <module>
File "D:\program oppinet\pyoppinet\helper\__init__.py", line 3, in <module>
# Copyright © 2011 Pierre Raybaut
File "D:\program oppinet\pyoppinet\helper\UnitInfo.py", line 2, in <module>
File "D:\program oppinet\pyoppinet\C_API\converter.py", line 26, in <module>
File "D:\program oppinet\pyoppinet\C_API\converter.py", line 18, inswig_import_helper
ImportError: No module named _converter
我认为该错误是由 spyder 中的设置引起的,可能是在工具或其他东西中。我可以更改 spyder 中的某些设置来解决此问题吗?