PySide“ hello world”:py2exe / pyinstaller / cx_freeze和访问冲突 [英] PySide "hello world": py2exe/pyinstaller/cx_freeze and access violation

查看:71
本文介绍了PySide“ hello world”:py2exe / pyinstaller / cx_freeze和访问冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用PySide构建一个非常基本的可执行文件(Windows)。以下脚本在解释器中正常运行(Python 2.7,PySide 1.1.2)

I am trying to build a very basic executable (Windows) using PySide. The following script runs properly in the interpreter (Python 2.7, PySide 1.1.2)

#!/usr/bin/python

import sys

sys.stdout = open("my_stdout.log", "w")
sys.stderr = open("my_stderr.log", "w")

import PySide.QtGui
from PySide.QtGui import QApplication
from PySide.QtGui import QMessageBox


# Create the application object
app = QApplication(sys.argv)

# Create a simple dialog box
msgBox = QMessageBox()
msgBox.setText("Hello World - using PySide version " + PySide.__version__)
msgBox.exec_()

我尝试了3种方法(py2exe,pyinstaller和cx_freeze)以及所有3个生成的可执行文件均无法执行。出现两个stdout / stderr文件,因此我发现第一次PySide导入使所有操作失败。 (未处理的异常/访问冲突)

I tried 3 methods (py2exe, pyinstaller and cx_freeze) and all the 3 generated executables fail to execute. The two stdout/stderr files appear, so I found the first PySide import is making everything fail. (Unhandled exception/Access violation)

我分析了依赖文件( http://www.dependencywalker.com/ ),一切看起来都正确链接。

I analyzed the executable file with depends (http://www.dependencywalker.com/) and everything looks correctly linked.

有什么想法吗?

推荐答案

感谢您的帮助。实际上,这并没有任何改变:/但是,我找到了解决我问题的方法:如果我从PySide导入导入QtCore,QtGui ,那么可执行文件(使用pyinstaller)就可以了工作!

Thank you for your help. Actually, this did not change anything :/ However, I found a solution to my problem: if I add from PySide import QtCore, QtGui, then the executable (with pyinstaller) does work!

这篇关于PySide“ hello world”:py2exe / pyinstaller / cx_freeze和访问冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆