私はWindows 7(64ビット)でPyInstallerを使って遊んでいます。現在Python 2.7.6でPyInstaller 3.1.1を使用しています。私は、単純なPySide GUIを作成するアプリを作成し、このコマンドで実行可能でdistのフォルダを生成:PySideとのPyInstallerエラー
> C:\Python27\Scripts\pyinstaller.exe .\HelloWidget.spec
これは、specファイルは次のようになります。
# -*- mode: python -*-
block_cipher = None
a = Analysis(['HelloWidget.py'],
pathex=['C:\\Users\\spearsc\\Documents\\python_projects\\HelloWorldGui'],
binaries=None,
datas=[('.\\mainwindow.ui', '.')],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='HelloWidget',
debug=False,
strip=False,
upx=True,
console=True)
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='HelloWidget')
私が使用していましたspecファイルであるため、.uiファイルは他のすべてと一緒にバンドルされます。私は実行可能ファイルを実行したときしかし、私はこのエラーを取得する:私には混乱して何
> .\HelloWidget.exe
Traceback (most recent call last):
File "<string>", line 41, in <module>
File "c:\users\spearsc\appdata\local\temp\pip-build-djws3k\pyinstaller\PyInstaller\loader\pyimod03_importers.py", line
389, in load_module
File "PySide-1.2.2\PySide\__init__.py", line 55, in <module>
File "PySide-1.2.2\PySide\__init__.py", line 11, in _setupQtDirectories
File "PySide-1.2.2\PySide\_utils.py", line 87, in get_pyside_dir
File "PySide-1.2.2\PySide\_utils.py", line 83, in _get_win32_case_sensitive_name
File "PySide-1.2.2\PySide\_utils.py", line 58, in _get_win32_short_name
WindowsError: [Error 2] The system cannot find the file specified.
pyi_rth_qt4plugins returned -1
は、私はdistのフォルダに見たとき、私はコンパイルPySideとQtのファイルを参照してくださいということです。
Directory: C:\Users\spearsc\Documents\python_projects\HelloWorldGui\dist\HelloWidget
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 5/23/2016 4:45 PM 80896 bz2.pyd
-a--- 5/24/2016 5:20 PM 795278 HelloWidget.exe
-a--- 5/24/2016 5:20 PM 1019 HelloWidget.exe.manifest
-a--- 5/24/2016 4:42 PM 4102 mainwindow.ui
-a--- 5/24/2016 5:20 PM 1052 Microsoft.VC90.CRT.manifest
-a--- 5/23/2016 4:45 PM 245760 msvcm90.dll
-a--- 5/23/2016 4:45 PM 853328 msvcp90.dll
-a--- 5/23/2016 4:45 PM 641360 msvcr90.dll
-a--- 5/24/2016 4:43 PM 248320 pyside-python2.7.dll
-a--- 5/24/2016 4:43 PM 3063808 PySide.QtCore.pyd
-a--- 5/24/2016 4:43 PM 12750848 PySide.QtGui.pyd
-a--- 5/24/2016 4:43 PM 1095168 PySide.QtNetwork.pyd
-a--- 5/24/2016 4:43 PM 1052672 PySide.QtUiTools.pyd
-a--- 5/23/2016 4:45 PM 3004928 python27.dll
-a--- 5/24/2016 4:43 PM 3469824 QtCore4.dll
-a--- 5/24/2016 4:43 PM 11679744 QtGui4.dll
-a--- 5/24/2016 4:43 PM 1473536 QtNetwork4.dll
-a--- 5/23/2016 4:45 PM 10752 select.pyd
-a--- 5/24/2016 4:43 PM 330752 shiboken-python2.7.dll
-a--- 5/23/2016 4:45 PM 689664 unicodedata.pyd
-a--- 5/24/2016 4:43 PM 111616 _ctypes.pyd
-a--- 5/23/2016 4:45 PM 474624 _hashlib.pyd
何かご意見は? distフォルダに表示されているものを信用できませんか?
5/25/16:
これは興味深いです。 _get_win32_short_name関数にprintステートメントを置いています。
def _get_win32_short_name(s):
""" Returns short name """
print s
buf_size = MAX_PATH
for i in range(2):
buf = create_unicode_buffer(u('\0') * (buf_size + 1))
r = GetShortPathNameW(u(s), buf, buf_size)
if r == 0:
raise WinError()
if r < buf_size:
if PY_2:
return buf.value.encode(sys.getfilesystemencoding())
return buf.value
buf_size = r
raise WinError()
これは、新しい実行可能ファイルを作成した後の結果です。
> .\HelloWidget.exe
C:\Users\spearsc\DOCUME~1\PYTHON~1\HELLOW~1\dist\HELLOW~1\PySide
Traceback (most recent call last):
File "<string>", line 41, in <module>
File "c:\users\spearsc\appdata\local\temp\pip-build-djws3k\pyinstaller\PyInstaller\loader\pyimod03_importers.py", line
389, in load_module
File "PySide-1.2.2\PySide\__init__.py", line 55, in <module>
File "PySide-1.2.2\PySide\__init__.py", line 11, in _setupQtDirectories
File "PySide-1.2.2\PySide\_utils.py", line 88, in get_pyside_dir
File "PySide-1.2.2\PySide\_utils.py", line 84, in _get_win32_case_sensitive_name
File "PySide-1.2.2\PySide\_utils.py", line 59, in _get_win32_short_name
WindowsError: [Error 2] The system cannot find the file specified.
pyi_rth_qt4plugins returned -1
ディレクトリが存在しません。それを回避する方法に関するアイデア?
私はこの問題の原因はPySideがサイトパッケージにないことだと思います。それは別の場所にありました。 –