问题描述
我正在尝试为 windows 构建我的 python pyqt5 gui 应用程序,运行后:
i'm trying to build my python pyqt5 gui application for windows, after running:
fbs startproject fbs freeze
使用 pyinstaller 我也得到相同的结果这是我的规范文件:
using pyinstaller i get also the same results this is my spec file:
# -*- 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')
然后尝试运行目标文件夹中的可执行文件,我收到此错误:
then trying to run the executable file in target folder, i get this error:
有谁知道如何解决这个问题,或者可能是什么原因造成的?
does anyone know how to fix this, or what might be causing it?
如果它有助于我使用 python 3.7
if it helps im using python 3.7
我尝试了 python 3.6 并重新安装了所有内容,但仍然出现相同的错误.
i tried python 3.6 and reinstalling everything, still getting the same error.
编辑 2:错误日志:
traceback (most recent call last): file "targetpyinstallerfbs_pyinstaller_hook.py", line 2, infile "importlib\__init__.py", line 126, in import_module file " ", line 978, in _gcd_import file " ", line 961, in _find_and_load file " ", line 936, in _find_and_load_unlocked file " ", line 205, in _call_with_frames_removed file " ", line 978, in _gcd_import file " ", line 961, in _find_and_load file " ", line 948, in _find_and_load_unlocked modulenotfounderror: no module named 'fbs_runtime' [16452] failed to execute script fbs_pyinstaller_hook
推荐答案
我发现了问题,或者好像是问题,显然pyinstaller没有一路安装,看github的时候发现pyinstaller-我安装的钩子,然后它工作了,所以一定要:
i figured out the issue, or it seems to be the issue, apparently pyinstaller didnt install all the way, when i looked at the github, i noticed pyinstaller-hooks which is what i installed, then it worked, so be sure to:
pip install pyinstaller-hooks
我希望这会有所帮助!