PyQtを使用して小さなアプリケーションを構築し、py2exeを使用して実行可能セットアップにしました。私のラップトップではすべて問題ありませんが、アプリケーションを他のマシンに配布しようとすると、開くことができず、.logファイルに次のエラーが発生します。
Traceback (most recent call last):
File "viewer.py", line 5, in <module>
File "PyQt4\QtCore.pyo", line 12, in <module>
File "PyQt4\QtCore.pyo", line 10, in __load
ImportError: DLL load failed: %1 is not a valid Win32 application.
私はたくさん試しましたが、この解決策を得ることができませんでした。私を助けてください !!
編集 :
これがsetup.pyです
#!/usr/bin/python
import sys
#C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91
#sys.path.append("C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\redist\\x86\\Microsoft.VC90.CRT")
import warnings
warnings.filterwarnings(action="ignore", message='the sets module is deprecated')
from distutils.core import setup
import py2exe
manifest = '''
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
<assemblyIdentity
version="0.64.1.0"
processorArchitecture="x86"
name="Controls"
type="win32"
/>
<description>Your Application</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
'''
'''
installs manifest and icon into the .exe
but icon is still needed as we open it
for the window icon (not just the .exe)
changelog and logo are included in dist
'''
sys.path.append('C:\\WINDOWS\\WinSxS\\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91')
excludes = ["pywin", "pywin.debugger", "pywin.debugger.dbgcon",
"pywin.dialogs", "pywin.dialogs.list"]
setup(
#options = {"py2exe": {"includes":["sip"],"dll_excludes": ["MSVCP90.dll"]}},
options = {"py2exe": {"typelibs":
# typelib for WMI
[('{565783C6-CB41-11D1-8B02-00600806D9B6}', 0, 1, 2)],
# create a compressed zip archive
"compressed": 1,
"optimize": 2,
"excludes": excludes,
"includes":["sip","PyQt4"]}},
# The lib directory contains everything except the executables and the python dll.
# Can include a subdirectory name.
zipfile = "lib/shared.zip",
windows = [
{
"script": "viewer.py",
#"icon_resources": [(1, "favicon.png")],
#"other_resources": [(24,1,manifest)]
}
],
data_files=["msvcm90.dll","msvcp90.dll","msvcr90.dll"]
)