当我从PySide导入东西时,PyInstaller停止工作

时间:2013-07-12 09:13:41

标签: python pyside pyinstaller

当我使用PyInstaller构建一个简单的hello world应用程序时,它按预期工作。但是只要我从PySide导入一些内容就会停止工作。这是main.py:

from PySide.QtGui import QApplication
print "Hello World"

构建过程顺利进行,但生成的二进制文件不起作用:

(pyside) C:\Test\pyinstaller>main\dist\main\main.exe
Traceback (most recent call last):
  File "<string>", line 5, in <module>
  File "C:\Test\pyinstaller\PyInstaller\loader\iu.py", line 386, in importHook
    mod = _self_doimport(nm, ctx, fqname)
  File "C:\Test\pyinstaller\PyInstaller\loader\iu.py", line 480, in doimport
    exec co in mod.__dict__
  File "C:\Test\pyinstaller\main\build\pyi.win32\main\out00-PYZ.pyz\PySide", lin
e 55, in <module>
  File "C:\Test\pyinstaller\main\build\pyi.win32\main\out00-PYZ.pyz\PySide", lin
e 11, in _setupQtDirectories
  File "C:\Test\pyinstaller\main\build\pyi.win32\main\out00-PYZ.pyz\PySide._util
s", line 87, in get_pyside_dir
  File "C:\Test\pyinstaller\main\build\pyi.win32\main\out00-PYZ.pyz\PySide._util
s", line 83, in _get_win32_case_sensitive_name
  File "C:\Test\pyinstaller\main\build\pyi.win32\main\out00-PYZ.pyz\PySide._util
s", line 58, in _get_win32_short_name
WindowsError: [Error 123] The filename, directory name, or volume label syntax i
s incorrect.

请注意,即使我只是导入PySide模块,而不是实际使用它,也会发生这种情况。我该怎么办?

我正在使用PyInstaller 2.0在64位Windows 7上使用PySide 1.2打包应用程序。我的Python安装是32位:

Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32
>pip freeze
pyside==1.2.0
pywin32==218

这是构建消息:

(pyside) C:\Test\pyinstaller>python pyinstaller.py ..\main.py
90 INFO: wrote C:\Test\pyinstaller\main\main.spec
113 INFO: Testing for ability to set icons, version resources...
162 INFO: ... resource update available
204 INFO: UPX is available.
1237 INFO: checking Analysis
1237 INFO: building Analysis because out00-Analysis.toc non existent
1238 INFO: running Analysis out00-Analysis.toc
1240 INFO: Adding Microsoft.VC90.CRT to dependent assemblies of final executable

1313 INFO: Searching for assembly x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21
022.8_none ...
1314 INFO: Found manifest C:\Windows\WinSxS\Manifests\x86_microsoft.vc90.crt_1fc
8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91.manifest
1316 INFO: Searching for file msvcr90.dll
1317 INFO: Found file C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_
9.0.21022.8_none_bcb86ed6ac711f91\msvcr90.dll
1317 INFO: Searching for file msvcp90.dll
1319 INFO: Found file C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_
9.0.21022.8_none_bcb86ed6ac711f91\msvcp90.dll
1319 INFO: Searching for file msvcm90.dll
1319 INFO: Found file C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_
9.0.21022.8_none_bcb86ed6ac711f91\msvcm90.dll
1447 INFO: Analyzing C:\Test\pyinstaller\support\_pyi_bootstrap.py
2601 INFO: Analyzing C:\Test\pyinstaller\PyInstaller\loader\archive.py
2687 INFO: Analyzing C:\Test\pyinstaller\PyInstaller\loader\carchive.py
2776 INFO: Analyzing C:\Test\pyinstaller\PyInstaller\loader\iu.py
2800 INFO: Analyzing ..\main.py
2893 INFO: Hidden import 'encodings' has been found otherwise
2894 INFO: Looking for run-time hooks
2895 INFO: Analyzing rthook C:\Test\pyinstaller\support/rthooks/pyi_rth_encoding
s.py
7438 INFO: Warnings written to C:\Test\pyinstaller\main\build\pyi.win32\main\war
nmain.txt
7444 INFO: checking PYZ
7445 INFO: rebuilding out00-PYZ.toc because out00-PYZ.pyz is missing
7445 INFO: building PYZ out00-PYZ.toc
8059 INFO: checking PKG
8060 INFO: rebuilding out00-PKG.toc because out00-PKG.pkg is missing
8061 INFO: building PKG out00-PKG.pkg
8072 INFO: checking EXE
8073 INFO: rebuilding out00-EXE.toc because main.exe missing
8073 INFO: building EXE from out00-EXE.toc
8075 INFO: Appending archive to EXE C:\Test\pyinstaller\main\build\pyi.win32\mai
n\main.exe
8151 INFO: checking COLLECT
8151 INFO: building COLLECT out00-COLLECT.toc

编辑:即使我按照this answer中的建议拨打from PySide import QtGui,也会发生这种情况。

1 个答案:

答案 0 :(得分:1)

遇到相同的问题,使用PyInstaller 1.5解决。