简体   繁体   English

应用程序未编译为 *. exe(PySide2)

[英]The application is not compiled to *. exe (PySide2)

I have the files:我有文件:

在此处输入图像描述

I tried compiling the program with commands:我尝试使用命令编译程序:

pyinstaller --name="MyApplication" --windowed --onefile main.py

and

pyinstaller --name="MyApplication" --windowed --onefile main.py -p "D:\ProgramData\Anaconda3\Lib\site-packages\PySide2\Qt5Core.dll"

But after compilation it returned an error:但编译后返回错误:

在此处输入图像描述

PyInstaller: PyInstaller:

1965 INFO: PyInstaller: 3.6
1965 INFO: Python: 3.7.6 (conda)
1966 INFO: Platform: Windows-10-10.0.18362-SP0
2006 INFO: wrote D:\Desktop\projects\Qt\QR\QR\compile\MyApplication.spec
2141 INFO: UPX is not available.
2188 INFO: Extending PYTHONPATH with paths
['D:\\Desktop\\projects\\Qt\\QR\\QR\\compile',
 'D:\\ProgramData\\Anaconda3\\Lib\\site-packages\\PySide2\\Qt5Core.dll',
 'D:\\Desktop\\projects\\Qt\\QR\\QR\\compile']
2188 INFO: checking Analysis
2188 INFO: Building Analysis because Analysis-00.toc is non existent
2188 INFO: Initializing module dependency graph...
2336 INFO: Caching module graph hooks...
2444 INFO: Analyzing base_library.zip ...
12017 INFO: Caching module dependency graph...
12208 INFO: running Analysis Analysis-00.toc
12286 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by d:\programdata\anaconda3\python.exe
13941 INFO: Analyzing D:\Desktop\projects\Qt\QR\QR\compile\main.py
14355 INFO: Processing pre-safe import module hook   six.moves
16323 INFO: Processing pre-find module path hook   distutils
16379 INFO: distutils: retargeting to non-venv dir 'd:\\programdata\\anaconda3\\lib'
20050 INFO: Processing pre-find module path hook   site
20079 INFO: site: retargeting to fake-dir 'd:\\programdata\\anaconda3\\lib\\site-packages\\PyInstaller\\fake-modules'
23250 INFO: Processing pre-safe import module hook   setuptools.extern.six.moves
34300 INFO: Processing module hooks...
34301 INFO: Loading module hook "hook-distutils.py"...
34453 INFO: Loading module hook "hook-encodings.py"...
34765 INFO: Loading module hook "hook-lib2to3.py"...
34872 INFO: Loading module hook "hook-numpy.core.py"...
37928 INFO: Loading module hook "hook-numpy.py"...
37962 INFO: Loading module hook "hook-PIL.Image.py"...
39111 INFO: Loading module hook "hook-PIL.py"...
39145 INFO: Excluding import 'PyQt5'
39147 INFO:   Removing import of PyQt5.QtCore from module PIL.ImageQt
39147 INFO:   Removing import of PyQt5.QtGui from module PIL.ImageQt
39147 INFO: Import to be excluded not found: 'PySide'
39148 INFO: Import to be excluded not found: 'FixTk'
39148 INFO: Import to be excluded not found: 'PyQt4'
39148 INFO: Excluding import 'tkinter'
39149 INFO:   Removing import of tkinter from module PIL.ImageTk
39150 INFO: Loading module hook "hook-PIL.SpiderImagePlugin.py"...
39171 INFO: Import to be excluded not found: 'FixTk'
39172 INFO: Excluding import 'tkinter'
39172 INFO: Loading module hook "hook-pkg_resources.py"...
40044 INFO: Processing pre-safe import module hook   win32com
40324 INFO: Excluding import '__main__'
40325 INFO:   Removing import of __main__ from module pkg_resources
40325 INFO: Loading module hook "hook-pycparser.py"...
40345 INFO: Loading module hook "hook-pydoc.py"...
40352 INFO: Loading module hook "hook-PyQt5.py"...
42438 INFO: Loading module hook "hook-PyQt5.QtCore.py"...
42724 INFO: Loading module hook "hook-PyQt5.QtGui.py"...
43047 INFO: Loading module hook "hook-PySide2.py"...
52703 INFO: Loading module hook "hook-PySide2.QtCore.py"...
53386 INFO: Loading module hook "hook-PySide2.QtGui.py"...
53822 INFO: Loading module hook "hook-PySide2.QtNetwork.py"...
54748 INFO: Loading module hook "hook-PySide2.QtWidgets.py"...
55237 INFO: Loading module hook "hook-pythoncom.py"...
55596 INFO: Loading module hook "hook-pywintypes.py"...
55899 INFO: Loading module hook "hook-setuptools.py"...
56633 INFO: Loading module hook "hook-sysconfig.py"...
56653 INFO: Loading module hook "hook-win32com.py"...
57938 INFO: Loading module hook "hook-xml.dom.domreg.py"...
57961 INFO: Loading module hook "hook-xml.etree.cElementTree.py"...
57975 INFO: Loading module hook "hook-xml.py"...
57983 INFO: Loading module hook "hook-_tkinter.py"...
58831 INFO: checking Tree
58832 INFO: Building Tree because Tree-00.toc is non existent
58832 INFO: Building Tree Tree-00.toc
59632 INFO: checking Tree
59633 INFO: Building Tree because Tree-01.toc is non existent
59633 INFO: Building Tree Tree-01.toc
59794 INFO: Looking for ctypes DLLs
59953 INFO: Analyzing run-time hooks ...
59958 INFO: Including run-time hook 'pyi_rth_pyside2.py'
59999 INFO: Including run-time hook 'pyi_rth_pkgres.py'
60001 INFO: Including run-time hook 'pyi_rth_win32comgenpy.py'
60013 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
60026 INFO: Looking for dynamic libraries
60223 WARNING: lib not found: libpng16.dll dependency of D:\ProgramData\Anaconda3\Library\plugins\platforms\qminimal.dll
60232 WARNING: lib not found: zlib.dll dependency of D:\ProgramData\Anaconda3\Library\plugins\platforms\qminimal.dll
60549 WARNING: lib not found: zlib.dll dependency of D:\ProgramData\Anaconda3\Library\plugins\platforms\qwindows.dll
60557 WARNING: lib not found: libpng16.dll dependency of D:\ProgramData\Anaconda3\Library\plugins\platforms\qwindows.dll
60684 WARNING: lib not found: libjpeg.dll dependency of D:\ProgramData\Anaconda3\Library\plugins\imageformats\qjpeg.dll
60727 WARNING: lib not found: libpng16.dll dependency of D:\ProgramData\Anaconda3\Library\plugins\platforms\qoffscreen.dll
60737 WARNING: lib not found: zlib.dll dependency of D:\ProgramData\Anaconda3\Library\plugins\platforms\qoffscreen.dll
60930 WARNING: lib not found: zlib.dll dependency of D:\ProgramData\Anaconda3\Library\plugins\imageformats\qtiff.dll
63069 INFO: Looking for eggs
63069 INFO: Using Python library d:\programdata\anaconda3\python37.dll
63069 INFO: Found binding redirects:
[]
63076 INFO: Warnings written to D:\Desktop\projects\Qt\QR\QR\compile\build\MyApplication\warn-MyApplication.txt
63201 INFO: Graph cross-reference written to D:\Desktop\projects\Qt\QR\QR\compile\build\MyApplication\xref-MyApplication.html
63306 INFO: checking PYZ
63307 INFO: Building PYZ because PYZ-00.toc is non existent
63307 INFO: Building PYZ (ZlibArchive) D:\Desktop\projects\Qt\QR\QR\compile\build\MyApplication\PYZ-00.pyz
64636 INFO: Building PYZ (ZlibArchive) D:\Desktop\projects\Qt\QR\QR\compile\build\MyApplication\PYZ-00.pyz completed successfully.
64710 INFO: checking PKG
64711 INFO: Building PKG because PKG-00.toc is non existent
64711 INFO: Building PKG (CArchive) PKG-00.pkg
77887 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
77892 INFO: Bootloader d:\programdata\anaconda3\lib\site-packages\PyInstaller\bootloader\Windows-64bit\runw.exe
77892 INFO: checking EXE
77892 INFO: Building EXE because EXE-00.toc is non existent
77892 INFO: Building EXE from EXE-00.toc
77892 INFO: Appending archive to EXE D:\Desktop\projects\Qt\QR\QR\compile\dist\MyApplication.exe
78059 INFO: Building EXE from EXE-00.toc completed successfully.

I used methods from here, but it didn't help: https://ru.stackoverflow.com/questions/1075846/%D0%9A%D0%B0%D0%BA-%D1%81%D0%BA%D0%BE%D0%BC%D0%BF%D0%B8%D0%BB%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D1%82%D1%8C-%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D1%83-%D1%81-%D0%B8%D0%BD%D1%82%D0%B5%D1%80%D1%84%D0%B5%D0%B9%D1%81%D0%BE%D0%BC-%D0%BD%D0%B0-qt-%D0%B2-exe-%D1%84%D0%B0%D0%B9%D0%BB我使用了这里的方法,但没有帮助: https://ru.stackoverflow.com/questions/1075846/%D0%9A%D0%B0%D0%BA-%D1%81%D0%BA%D0 %BE%D0%BC%D0%BF%D0%B8%D0%BB%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D1%82%D1%8C-%D0% BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D1%83-%D1%81-%D0%B8%D0%BD%D1% 82%D0%B5%D1%80%D1%84%D0%B5%D0%B9%D1%81%D0%BE%D0%BC-%D0%BD%D0%B0-qt-%D0%B2- exe-%D1%84%D0%B0%D0%B9%D0%BB

Output of the compiled file:编译文件的Output:

Traceback (most recent call last):
  File "PyInstaller\loader\pyiboot01_bootstrap.py", line 144, in __init__
  File "ctypes\__init__.py", line 364, in __init__
OSError: [WinError 126] Не найден указанный модуль

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "pyzbar\zbar_library.py", line 58, in load
  File "pyzbar\zbar_library.py", line 52, in load_objects
  File "pyzbar\zbar_library.py", line 52, in <listcomp>
  File "ctypes\__init__.py", line 442, in LoadLibrary
  File "PyInstaller\loader\pyiboot01_bootstrap.py", line 146, in __init__
__main__.PyInstallerImportError: Failed to load dynlib/dll 'libiconv.dll'. Most probably this dynlib/dll was not found when the application was frozen.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "PyInstaller\loader\pyiboot01_bootstrap.py", line 144, in __init__
  File "ctypes\__init__.py", line 364, in __init__
OSError: [WinError 126] Не найден указанный модуль

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "main.py", line 6, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "c:\program files\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
    exec(bytecode, module.__dict__)
  File "pyzbar\pyzbar.py", line 7, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "c:\program files\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
    exec(bytecode, module.__dict__)
  File "pyzbar\wrapper.py", line 143, in <module>
  File "pyzbar\wrapper.py", line 136, in zbar_function
  File "pyzbar\wrapper.py", line 115, in load_libzbar
  File "pyzbar\zbar_library.py", line 60, in load
  File "pyzbar\zbar_library.py", line 52, in load_objects
  File "pyzbar\zbar_library.py", line 52, in <listcomp>
  File "ctypes\__init__.py", line 442, in LoadLibrary
  File "PyInstaller\loader\pyiboot01_bootstrap.py", line 146, in __init__
__main__.PyInstallerImportError: Failed to load dynlib/dll 'D:\\Desktop\\projects\\Qt\\QR\\QR\\compile\\dist\\main\\pyzbar\\libiconv.dll'. Most probably this dynlib/dll was not found when the application was frozen.
[25136] Failed to execute script main

Am I doing something wrong?难道我做错了什么? How can I compile PySide to an exe file?如何将 PySide 编译为 exe 文件?

I fix it.我修复它。 The error was due to the 'pyzbar' module that didn't want to compile properly 'pyinstaller'该错误是由于 'pyzbar' 模块不想正确编译 'pyinstaller'

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

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