Я создал небольшое графическое приложение, используя PySide2 в качестве моей графической инфраструктуры и PyInstaller для создания exe-файла из одного файла.
Приложение отлично работает на некоторых ПК (как Windows 7, так и 10), однако нана некоторых других компьютерах он не запускается - отображается сообщение об ошибке:
'Неустранимая ошибка !: Не удалось выполнить скрипт pyi_rth_qt5plugins'
Я считаю, что это может не включать Qt5Gui.dll, Qt5Core.dll и Qt5Widgets.dll, однако я не знаю, как это сделать с помощью PyInstaller.
Кто-нибудь знает, как можно это исправить?
Вот мой файл .spec:
# -*- mode: python -*-
block_cipher = None
a = Analysis(['main.py'],
pathex=[],
binaries=[],
datas=[],
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,
a.binaries,
a.zipfiles,
a.datas,
name='Application',
debug=True,
strip=False,
upx=True,
runtime_tmpdir=None,
console=True , icon='Images\\Application_icon.ico')
Редактировать
Вот полный вывод при запуске из cmd и debug = True.Единственное, что мне показалось странным, это то, что он ссылался на ПК, на котором я разработал приложение (например, File "c:\users\jake\Projects\Application\venv\lib\site-packages\PyInsta
ller\loader\pyimod03_importers.py", line 714, in load_module
), вместо ПК, на котором я тестировал, и получил это сообщение об ошибке.
[4588] PyInstaller Bootloader 3.x
[4588] LOADER: executable is C:\Users\User\Desktop\Application.exe
[4588] LOADER: homepath is C:\Users\User\Desktop
[4588] LOADER: _MEIPASS2 is NULL
[4588] LOADER: archivename is C:\Users\User\Desktop\Application.exe
[4588] LOADER: Extracting binaries
[4588] LOADER: Executing self as child
[4588] LOADER: set _MEIPASS2 to C:\Users\User\AppData\Local\Temp\_MEI45882
[4588] LOADER: Setting up to run child
[4588] LOADER: Creating child process
[4588] LOADER: Waiting for child process to finish...
[4752] PyInstaller Bootloader 3.x
[4752] LOADER: executable is C:\Users\User\Desktop\Application.exe
[4752] LOADER: homepath is C:\Users\User\Desktop
[4752] LOADER: _MEIPASS2 is C:\Users\User\AppData\Local\Temp\_MEI45882
[4752] LOADER: archivename is C:\Users\User\Desktop\Application.exe
[4752] LOADER: SetDllDirectory(C:\Users\User\AppData\Local\Temp\_MEI45882)
[4752] LOADER: Already in the child - running user's code.
[4752] LOADER: manifestpath: C:\Users\User\AppData\Local\Temp\_MEI45882\Application.exe.manifest
[4752] LOADER: Activation context created
[4752] LOADER: Activation context activated
[4752] LOADER: Python library: C:\Users\User\AppData\Local\Temp\_MEI45882\py
thon36.dll
[4752] LOADER: Loaded functions from Python library.
[4752] LOADER: Manipulating environment (sys.path, sys.prefix)
[4752] LOADER: Pre-init sys.path is C:\Users\User\AppData\Local\Temp\_MEI458
82\base_library.zip;C:\Users\User\AppData\Local\Temp\_MEI45882
[4752] LOADER: sys.prefix is C:\Users\User\AppData\Local\Temp\_MEI45882
[4752] LOADER: Setting runtime options
[4752] LOADER: Bootloader option: pyi-windows-manifest-filename Folder Hatcher.e
xe.manifest
[4752] LOADER: Initializing python
[4752] LOADER: Overriding Python's sys.path
[4752] LOADER: Post-init sys.path is C:\Users\User\AppData\Local\Temp\_MEI45
882\base_library.zip;C:\Users\User\AppData\Local\Temp\_MEI45882
[4752] LOADER: Setting sys.argv
[4752] LOADER: setting sys._MEIPASS
[4752] LOADER: importing modules from CArchive
[4752] LOADER: extracted struct
[4752] LOADER: callfunction returned...
[4752] LOADER: extracted pyimod01_os_path
[4752] LOADER: callfunction returned...
[4752] LOADER: extracted pyimod02_archive
[4752] LOADER: callfunction returned...
[4752] LOADER: extracted pyimod03_importers
[4752] LOADER: callfunction returned...
[4752] LOADER: Installing PYZ archive with Python modules.
[4752] LOADER: PYZ archive: PYZ-00.pyz
[4752] LOADER: Running pyiboot01_bootstrap.py
[4752] LOADER: Running pyi_rth_qt5plugins.py
Traceback (most recent call last):
File "site-packages\PyInstaller\loader\rthooks\pyi_rth_qt5plugins.py", line 47
, in <module>
ModuleNotFoundError: No module named 'PyQt5'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\jake\Projects\Application\venv\lib\site-packages\PyInsta
ller\loader\pyimod03_importers.py", line 712, in load_module
File "<frozen importlib._bootstrap_external>", line 399, in _check_name_wrappe
r
File "<frozen importlib._bootstrap_external>", line 823, in load_module
File "<frozen importlib._bootstrap_external>", line 682, in load_module
File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
File "<frozen importlib._bootstrap>", line 684, in _load
File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
File "<frozen importlib._bootstrap>", line 571, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 922, in create_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "site-packages\PyInstaller\loader\rthooks\pyi_rth_qt5plugins.py", line 49
, in <module>
File "c:\users\jake\Projects\Application\venv\lib\site-packages\PyInsta
ller\loader\pyimod03_importers.py", line 714, in load_module
ImportError: DLL load failed: The specified module could not be found.: PySide2.
QtCore
[4752] Failed to execute script pyi_rth_qt5plugins
[4752] LOADER: OK.
[4752] LOADER: Cleaning up Python interpreter.
[4588] LOADER: Back to parent (RC: -1)
[4588] LOADER: Doing cleanup
[4588] LOADER: Freeing archive status for C:\Users\User\Desktop\Application.exe