我有一个使用pyinstaller构建的应用程序,它使用PySide作为其Qt Gui.我通过嵌入ipython qtconsole包含了一个交互式提示.这打破了pyinstaller创建的构建.
这是一个最小(非)工作的例子:
from PySide.QtGui import *
from IPython.qt.console.rich_ipython_widget import RichIPythonWidget
from IPython.qt.inprocess import QtInProcessKernelManager
from IPython.lib import guisupport
class IPythonWidget(RichIPythonWidget):
def __init__(self, parent=None, **kwargs):
super(self.__class__, self).__init__(parent)
self.app = app = guisupport.get_app_qt4()
self.kernel_manager = kernel_manager = QtInProcessKernelManager()
kernel_manager.start_kernel()
self.kernel = kernel = kernel_manager.kernel
kernel.gui = 'qt4'
self.kernel_client = kernel_client = kernel_manager.client()
kernel_client.start_channels()
if __name__ == '__main__':
app = QApplication([])
i = IPythonWidget()
i.show()
app.exec_()
Run Code Online (Sandbox Code Playgroud)
当直接从源(python mwe.py)运行时,它弹出一个ipython qt控制台窗口.当我在一个目录中使用pyinstaller捆绑这个并运行exe时,我得到这个:
Traceback (most recent call last):
File "<string>", line 3, in <module>
File …Run Code Online (Sandbox Code Playgroud)