繁体   English   中英

Pyinstaller 无法使用 PyQt5 正确构建

[英]Pyinstaller not building correctly with PyQt5

我一直在尝试使用 pyinstaller 构建一个项目。 该项目正在使用 PyQt5,但我无法正确构建它。 UPX 和 python 在我的路径中。 我不想弄乱任何包 python 文件,所以我不知道该怎么做。 这是cmd输出:

C:\Users\John\Desktop\Project_Convar\LarkEnv>pyinstaller -F myProject.py
60 INFO: PyInstaller: 3.5.dev0+cb8d10af6
61 INFO: Python: 3.6.2
62 INFO: Platform: Windows-10-10.0.17134-SP0
64 INFO: wrote C:\Users\John\Desktop\Project_Convar\LarkEnv\myProject.spec
428 INFO: UPX is available.
429 INFO: Extending PYTHONPATH with paths
['C:\\Users\\John\\Desktop\\Project_Convar\\LarkEnv',
 'C:\\Users\\John\\Desktop\\Project_Convar\\LarkEnv']
430 INFO: checking Analysis
461 INFO: checking PYZ
478 INFO: checking PKG
479 INFO: Building because toc changed
479 INFO: Building PKG (CArchive) PKG-00.pkg
483 INFO: Executing - upx --lzma -q 
... 
execute bunch of upx stuff 
...
C:\Users\John\AppData\Roaming\pyinstaller\bincache01_py36_64bit\qt5svg.dll
27209 WARNING: One binary added with two internal names.
27209 WARNING: ('libGLESv2.dll',
 'C:\\users\\John\\desktop\\project_convar\\larkenv\\lib\\site-packages\\PyQt5\\Qt\\bin\\libGLESv2.dll',
 'BINARY')
27211 WARNING: was placed previously at
27211 WARNING: ('PyQt5\\Qt\\bin\\libGLESv2.dll',
 'C:\\users\\John\\desktop\\project_convar\\larkenv\\lib\\site-packages\\PyQt5\\Qt\\bin\\libGLESv2.dll',
 'BINARY')
C:\Users\John\AppData\Roaming\pyinstaller\bincache01_py36_64bit\qt5qml.dll
Traceback (most recent call last):
  File "c:\users\John\appdata\local\programs\python\python36\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\John\appdata\local\programs\python\python36\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\John\AppData\Local\Programs\Python\Python36\Scripts\pyinstaller.exe\__main__.py", line 9, in <module>
  File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\__main__.py", line 111, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\__main__.py", line 63, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\building\build_main.py", line 844, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\building\build_main.py", line 791, in build
    exec(code, spec_namespace)
  File "C:\Users\John\Desktop\Project_Convar\LarkEnv\myProject.spec", line 32, in <module>
    console=True )
  File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\building\api.py", line 430, in __init__
    strip_binaries=self.strip, upx_binaries=self.upx,
  File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\building\api.py", line 196, in __init__
    self.__postinit__()
  File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\building\datastruct.py", line 158, in __postinit__
    self.assemble()
  File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\building\api.py", line 281, in assemble
    pylib_name=pylib_name)
  File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\archive\writers.py", line 334, in __init__
    super(CArchiveWriter, self).__init__(archive_path, logical_toc)
  File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\archive\writers.py", line 61, in __init__
    self._add_from_table_of_contents(logical_toc)
  File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\archive\writers.py", line 86, in _add_from_table_of_contents
    self.add(toc_entry)  # The guts of the archive.
  File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\archive\writers.py", line 375, in add
    code = get_code_object(nm, pathnm)
  File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\building\utils.py", line 623, in get_code_object
    co = _load_code(modname, filename)
  File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\building\utils.py", line 580, in _load_code
    loader = importer.find_module(modname)
AttributeError: 'NoneType' object has no attribute 'find_module'

我测试和 pyinstaller 对 PyQt5 没有任何问题。 在 CMD 中使用此代码:

pyinstaller --onefile myProject.py

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM