PyQt4在spyder中使用,程序只能运行一次,第二次运行报错:It seems the kernel died unexpectedly. Use 'Restart kernel' to cont

时间:2021-07-26 23:04:01


问题:PyQt4在spyder中使用,程序只能运行一次,第二次运行报错:It seems the kernel died unexpectedly. Use 'Restart kernel' to cont。只能关闭掉spyder后,重新打开方能再次运行。

解决方法:在程序中app = QtGui.QApplication( sys.argv )这句之后添加app.aboutToQuit.connect(app.deleteLater)