引入sys模块和QApplication模块 app = QApplication(sys.argv) // 你的代码 sys.exit(app.exec_()) 结语:接下来就可以开始pthon xxx.py了