无法为 pyqt5 gui 应用程序执行脚本 fbs_pyinstaller_hook
Failed to execute script fbs_pyinstaller_hook for pyqt5 gui application
我正在尝试为 windows 构建我的 python pyqt5 gui 应用程序,在 运行ning:
之后
fbs startproject
fbs freeze
使用 pyinstaller 我也得到了相同的结果
这是我的规范文件:
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
added_files = [
('C:\Users\Jared\Documents\Python Scripts\Bits App\bitsapp37\Lib\site-packages\PyQt5\Qt\bin\Qt5Core.dll', '.'),
('C:\Users\Jared\Documents\Python Scripts\Bits App\bitsapp37\Lib\site-packages\PyQt5\Qt\bin\Qt5Gui.dll', '.'),
('C:\Users\Jared\Documents\Python Scripts\Bits App\bitsapp37\Lib\site-packages\PyQt5\Qt\bin\Qt5Widgets.dll', '.')
]
a = Analysis(['C:\Users\Jared\Documents\Python Scripts\Bits App\main.py'],
pathex=['C:\Users\Jared\Documents\Python Scripts\Bits App\bitsapp37\Lib\site-packages\PyQt5\Qt\bin'],
binaries=[],
datas=[
('C:\Users\Jared\Documents\Python Scripts\Bits App\add.png', '.'),
('C:\Users\Jared\Documents\Python Scripts\Bits App\contact.png', '.'),
('C:\Users\Jared\Documents\Python Scripts\Bits App\config.png', '.'),
('C:\Users\Jared\Documents\Python Scripts\Bits App\import.png', '.'),
('C:\Users\Jared\Documents\Python Scripts\Bits App\settings.png', '.'),
('C:\Users\Jared\Documents\Python Scripts\Bits App\exit.png', '.'),
('C:\Users\Jared\Documents\Python Scripts\Bits App\delete.png', '.'),
('C:\Users\Jared\Documents\Python Scripts\Bits App\export.png', '.'),
('C:\Users\Jared\Documents\Python Scripts\Bits App\help.png', '.'),
],
hiddenimports=[],
hookspath=['c:\users\jared\docume~1\python~1\bitsap~1\bitsap~1\lib\site-packages\fbs\freeze\hooks'],
runtime_hooks=['C:\Users\Jared\Documents\Python Scripts\Bits App\target\PyInstaller\fbs_pyinstaller_hook.py'],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
[],
exclude_binaries=True,
name='main',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=False,
console=True ,
icon='C:\Users\Jared\Documents\Python Scripts\Bits App\icon5.ico')
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=False,
upx_exclude=[],
name='main')
然后尝试 运行 目标文件夹中的可执行文件,我收到此错误:
有谁知道如何解决这个问题,或者可能是什么原因造成的?
如果对我使用 python 3.7
有帮助
编辑:我试过 python 3.6 并重新安装所有内容,仍然出现相同的错误。
编辑 2:
错误日志:
Traceback (most recent call last):
File "target\PyInstaller\fbs_pyinstaller_hook.py", line 2, in <module>
File "importlib\__init__.py", line 126, in import_module
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 936, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'fbs_runtime'
[16452] Failed to execute script fbs_pyinstaller_hook
我发现了问题,或者似乎是问题所在,显然 pyinstaller 没有一路安装,当我查看 github 时,我注意到我安装的是 pyinstaller-hooks,然后它起作用了,所以一定要:
pip install pyinstaller-hooks
希望对您有所帮助!
我正在尝试为 windows 构建我的 python pyqt5 gui 应用程序,在 运行ning:
之后fbs startproject
fbs freeze
使用 pyinstaller 我也得到了相同的结果 这是我的规范文件:
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
added_files = [
('C:\Users\Jared\Documents\Python Scripts\Bits App\bitsapp37\Lib\site-packages\PyQt5\Qt\bin\Qt5Core.dll', '.'),
('C:\Users\Jared\Documents\Python Scripts\Bits App\bitsapp37\Lib\site-packages\PyQt5\Qt\bin\Qt5Gui.dll', '.'),
('C:\Users\Jared\Documents\Python Scripts\Bits App\bitsapp37\Lib\site-packages\PyQt5\Qt\bin\Qt5Widgets.dll', '.')
]
a = Analysis(['C:\Users\Jared\Documents\Python Scripts\Bits App\main.py'],
pathex=['C:\Users\Jared\Documents\Python Scripts\Bits App\bitsapp37\Lib\site-packages\PyQt5\Qt\bin'],
binaries=[],
datas=[
('C:\Users\Jared\Documents\Python Scripts\Bits App\add.png', '.'),
('C:\Users\Jared\Documents\Python Scripts\Bits App\contact.png', '.'),
('C:\Users\Jared\Documents\Python Scripts\Bits App\config.png', '.'),
('C:\Users\Jared\Documents\Python Scripts\Bits App\import.png', '.'),
('C:\Users\Jared\Documents\Python Scripts\Bits App\settings.png', '.'),
('C:\Users\Jared\Documents\Python Scripts\Bits App\exit.png', '.'),
('C:\Users\Jared\Documents\Python Scripts\Bits App\delete.png', '.'),
('C:\Users\Jared\Documents\Python Scripts\Bits App\export.png', '.'),
('C:\Users\Jared\Documents\Python Scripts\Bits App\help.png', '.'),
],
hiddenimports=[],
hookspath=['c:\users\jared\docume~1\python~1\bitsap~1\bitsap~1\lib\site-packages\fbs\freeze\hooks'],
runtime_hooks=['C:\Users\Jared\Documents\Python Scripts\Bits App\target\PyInstaller\fbs_pyinstaller_hook.py'],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
[],
exclude_binaries=True,
name='main',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=False,
console=True ,
icon='C:\Users\Jared\Documents\Python Scripts\Bits App\icon5.ico')
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=False,
upx_exclude=[],
name='main')
然后尝试 运行 目标文件夹中的可执行文件,我收到此错误:
有谁知道如何解决这个问题,或者可能是什么原因造成的?
如果对我使用 python 3.7
有帮助编辑:我试过 python 3.6 并重新安装所有内容,仍然出现相同的错误。
编辑 2: 错误日志:
Traceback (most recent call last):
File "target\PyInstaller\fbs_pyinstaller_hook.py", line 2, in <module>
File "importlib\__init__.py", line 126, in import_module
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 936, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'fbs_runtime'
[16452] Failed to execute script fbs_pyinstaller_hook
我发现了问题,或者似乎是问题所在,显然 pyinstaller 没有一路安装,当我查看 github 时,我注意到我安装的是 pyinstaller-hooks,然后它起作用了,所以一定要:
pip install pyinstaller-hooks
希望对您有所帮助!