执行pyinstaller可执行文件时获取ValueError:错误的元帅数据(未知类型代码)

时间:2019-12-10 20:48:56

标签: python python-3.x windows exe pyinstaller

我已使pyinstaller可执行文件,但出现此错误:

[16984] mod is NULL - pyimod02_archiveValueError: bad marshal data (unknown type code)
[16984] mod is NULL - pyimod03_importersTraceback (most recent call last):
  File "site-packages\PyInstaller\loader\pyimod03_importers.py", line 24, in <module>
    from pyimod02_archive import ArchiveReadError, ZlibArchiveReader
ModuleNotFoundError: No module named 'pyimod02_archive'
Traceback (most recent call last):
  File "site-packages\PyInstaller\loader\pyiboot01_bootstrap.py", line 15, in <module>
ModuleNotFoundError: No module named 'pyimod03_importers'
[16984] Failed to execute script pyiboot01_bootstrap

为什么会发生这种情况,我已经在Google上和此处的stackoverflow上进行了搜索,但是未找到任何有关为什么在执行 pyinstaller 应用程序 NOT 的同时安装其他程序时发生这种情况的原因的任何信息包装左右

这是我使用的构建命令:

pyinstaller -y --add-data "C:/projects/py_ide/py_ide";"py_ide/" --clean -n py_ide "C:/projects/py_ide/py_ide/__main__.py"

编辑:

我使用Windows,而我无法在Windows上使用该问题

我得到的构建输出是这样的:

455 INFO: PyInstaller: 3.4
456 INFO: Python: 3.7.4
459 INFO: Platform: Windows-10-10.0.18362-SP0
470 INFO: wrote C:\projects\py_ide\py_ide\py_ide.spec
481 INFO: UPX is not available.
481 INFO: Removing temporary files and cleaning cache in C:\Users\matthijs\AppData\Roaming\pyinstaller
525 INFO: Extending PYTHONPATH with paths
['C:\\projects\\py_ide', 'C:\\projects\\py_ide\\py_ide']
525 INFO: checking Analysis
527 INFO: Building Analysis because Analysis-00.toc is non existent
528 INFO: Initializing module dependency graph...
551 INFO: Initializing module graph hooks...
562 INFO: Analyzing base_library.zip ...
15229 INFO: running Analysis Analysis-00.toc
15291 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by c:\users\user\appdata\local\programs\python\python37\python.exe
17416 INFO: Caching module hooks...
17455 INFO: Analyzing C:\projects\py_ide\py_ide\__main__.py
19534 INFO: Processing pre-find module path hook   site
19541 INFO: site: retargeting to fake-dir 'c:\\users\\user\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\PyInstaller\\fake-modules'
23425 INFO: Processing pre-safe import module hook   six.moves
26519 INFO: Processing pre-find module path hook   distutils
69760 INFO: Processing pre-safe import module hook   setuptools.extern.six.moves
127545 INFO: Processing pre-safe import module hook   win32com
161311 INFO: Loading module hooks...
161313 INFO: Loading module hook "hook-astroid.py"...
165656 INFO: Loading module hook "hook-babel.py"...
166371 INFO: Loading module hook "hook-clr.py"...
166389 INFO: Loading module hook "hook-distutils.py"...
166396 INFO: Loading module hook "hook-docutils.py"...
177190 INFO: Loading module hook "hook-encodings.py"...
177512 INFO: Loading module hook "hook-jedi.py"...
177548 INFO: Loading module hook "hook-jinja2.py"...
177610 INFO: Loading module hook "hook-lib2to3.py"...
177661 INFO: Loading module hook "hook-numpy.core.py"...
179333 INFO: Loading module hook "hook-numpy.py"...
179341 INFO: Loading module hook "hook-PIL.Image.py"...
180898 INFO: Loading module hook "hook-PIL.py"...
180907 INFO: Excluding import 'PyQt5'
180914 INFO:   Removing import of PyQt5.QtCore from module PIL.ImageQt
180915 INFO:   Removing import of PyQt5.QtGui from module PIL.ImageQt
180917 INFO: Excluding import 'PySide'
180924 INFO:   Removing import of PySide from module PIL.ImageQt
180926 INFO: Import to be excluded not found: 'FixTk'
180926 INFO: Excluding import 'PyQt4'
180933 INFO:   Removing import of PyQt4.QtGui from module PIL.ImageQt
180936 INFO:   Removing import of PyQt4.QtCore from module PIL.ImageQt
180938 INFO: Excluding import 'tkinter'
180947 INFO:   Removing import of tkinter from module PIL.ImageTk
180948 INFO: Loading module hook "hook-PIL.SpiderImagePlugin.py"...
180956 INFO: Import to be excluded not found: 'FixTk'
180957 INFO: Excluding import 'tkinter'
180962 INFO: Loading module hook "hook-pkg_resources.py"...
185701 INFO: Loading module hook "hook-pycparser.py"...
186432 INFO: Loading module hook "hook-pydoc.py"...
186439 INFO: Loading module hook "hook-pygments.py"...
194130 INFO: Loading module hook "hook-pylint.py"...
201884 INFO: Loading module hook "hook-PyQt4.py"...
201890 INFO: Loading module hook "hook-PyQt4.QtCore.py"...
202439 INFO: Loading module hook "hook-PyQt4.QtGui.py"...
203621 INFO: Loading module hook "hook-PyQt5.py"...
204462 INFO: Loading module hook "hook-PyQt5.QtCore.py"...
204766 INFO: Loading module hook "hook-PyQt5.QtGui.py"...
205594 INFO: Loading module hook "hook-pytest.py"...
209847 INFO: Loading module hook "hook-pythoncom.py"...
212748 INFO: Loading module hook "hook-pytz.py"...
213314 INFO: Loading module hook "hook-pywintypes.py"...
216207 INFO: Loading module hook "hook-scipy.py"...
216237 INFO: Loading module hook "hook-setuptools.py"...
220340 INFO: Loading module hook "hook-sphinx.py"...
c:\users\user\appdata\local\programs\python\python37\lib\site-packages\sphinx\websupport\__init__.py:25: RemovedInSphinx20Warning: sphinx.websupport module is now provided as sphinxcontrib-websupport. sphinx.websupport will be removed at Sphinx-2.0. Please use the package instead.
  RemovedInSphinx20Warning)
234895 INFO: Processing pre-safe import module hook   urllib3.packages.six.moves
257867 INFO: Loading module hook "hook-sqlalchemy.py"...
258761 INFO:   Found 6 sqlalchemy hidden imports
259831 WARNING: Hidden import "sqlalchemy.sql.functions.func" not found!
259832 WARNING: Hidden import "sqlalchemy.orm.state", "sqlalchemy.orm.strategies" not found!
259938 INFO: Excluding import 'sqlalchemy.testing'
259950 INFO:   Removing import of sqlalchemy.testing.util from module sqlalchemy.orm.util
259952 INFO:   Removing import of sqlalchemy.testing.config from module sqlalchemy.testing
259952 INFO:   Removing import of sqlalchemy.testing.engines from module sqlalchemy.testing
259953 INFO:   Removing import of sqlalchemy.testing from module sqlalchemy.testing
259953 INFO:   Removing import of sqlalchemy.testing.exclusions from module sqlalchemy.testing
259953 INFO:   Removing import of sqlalchemy.testing.util from module sqlalchemy.testing
259953 INFO:   Removing import of sqlalchemy.testing.warnings from module sqlalchemy.testing
259954 INFO:   Removing import of sqlalchemy.testing.mock from module sqlalchemy.testing
259955 INFO:   Removing import of sqlalchemy.testing.assertions from module sqlalchemy.testing
259955 INFO:   Removing import of sqlalchemy.testing.assertsql from module sqlalchemy.testing
259955 INFO:   Removing import of sqlalchemy.testing from module sqlalchemy.testing.config
259955 INFO:   Removing import of sqlalchemy.testing from module sqlalchemy.testing.mock
259956 INFO:   Removing import of sqlalchemy.testing.config from module sqlalchemy.testing.assertions
259956 INFO:   Removing import of sqlalchemy.testing from module sqlalchemy.testing.assertions
259956 INFO:   Removing import of sqlalchemy.testing.exclusions from module sqlalchemy.testing.assertions
259960 INFO:   Removing import of sqlalchemy.testing.util from module sqlalchemy.testing.assertions
259961 INFO:   Removing import of sqlalchemy.testing.mock from module sqlalchemy.testing.assertions
259961 INFO:   Removing import of sqlalchemy.testing.assertsql from module sqlalchemy.testing.assertions
259962 INFO:   Removing import of sqlalchemy.testing from module sqlalchemy.testing.assertsql
259963 INFO:   Removing import of sqlalchemy.testing.config from module sqlalchemy.testing.util
259963 INFO:   Removing import of sqlalchemy.testing.engines from module sqlalchemy.testing.util
259964 INFO:   Removing import of sqlalchemy.testing from module sqlalchemy.testing.util
259964 INFO:   Removing import of sqlalchemy.testing.config from module sqlalchemy.testing.engines
259964 INFO:   Removing import of sqlalchemy.testing.assertions from module sqlalchemy.testing.engines
259965 INFO:   Removing import of sqlalchemy.testing from module sqlalchemy.testing.engines
259965 INFO:   Removing import of sqlalchemy.testing.util from module sqlalchemy.testing.engines
259969 INFO:   Removing import of sqlalchemy.testing.config from module sqlalchemy.testing.exclusions
260265 INFO:   Removing import of sqlalchemy.testing from module sqlalchemy.testing.exclusions
260265 INFO:   Removing import of sqlalchemy.testing.assertions from module sqlalchemy.testing.warnings
260267 INFO:   Removing import of sqlalchemy.testing from module sqlalchemy.testing.warnings
260267 INFO: Loading module hook "hook-sqlite3.py"...
260633 INFO: Loading module hook "hook-sysconfig.py"...
260639 INFO: Loading module hook "hook-win32com.py"...
261521 INFO: Loading module hook "hook-xml.dom.domreg.py"...
261529 INFO: Loading module hook "hook-xml.etree.cElementTree.py"...
261535 INFO: Loading module hook "hook-xml.py"...
261539 INFO: Loading module hook "hook-_tkinter.py"...
262145 INFO: checking Tree
262146 INFO: Building Tree because Tree-00.toc is non existent
262147 INFO: Building Tree Tree-00.toc
262782 INFO: checking Tree
262783 INFO: Building Tree because Tree-01.toc is non existent
262784 INFO: Building Tree Tree-01.toc
262890 INFO: Loading module hook "hook-appdirs.py"...
262901 INFO: Excluding import 'win32com'
262908 INFO:   Removing import of win32com.shell.shellcon from module appdirs
262908 INFO:   Removing import of win32com.shell from module appdirs
262908 INFO:   Removing import of win32com.shell.shell from module appdirs
262909 INFO: Loading module hook "hook-certifi.py"...
262917 INFO: Loading module hook "hook-cryptography.py"...
264234 INFO: Loading module hook "hook-lxml.etree.py"...
264659 INFO: Looking for ctypes DLLs
264997 INFO: Analyzing run-time hooks ...
265045 INFO: Including run-time hook 'pyi_rth__tkinter.py'
265068 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
265092 INFO: Including run-time hook 'pyi_rth_pkgres.py'
265228 INFO: Including run-time hook 'pyi_rth_win32comgenpy.py'
265347 INFO: Looking for dynamic libraries
289556 INFO: Looking for eggs
289556 INFO: Using Python library c:\users\user\appdata\local\programs\python\python37\python37.dll
289557 INFO: Found binding redirects:
[]
289644 INFO: Warnings written to C:\projects\py_ide\py_ide\build\py_ide\warn-py_ide.txt
290772 INFO: Graph cross-reference written to C:\projects\py_ide\py_ide\build\py_ide\xref-py_ide.html
291315 INFO: Appending 'datas' from .spec
291804 INFO: checking PYZ
291805 INFO: Building PYZ because PYZ-00.toc is non existent
291806 INFO: Building PYZ (ZlibArchive) C:\projects\py_ide\py_ide\build\py_ide\PYZ-00.pyz
302250 INFO: Building PYZ (ZlibArchive) C:\projects\py_ide\py_ide\build\py_ide\PYZ-00.pyz completed successfully.
302523 INFO: checking PKG
302524 INFO: Building PKG because PKG-00.toc is non existent
302525 INFO: Building PKG (CArchive) PKG-00.pkg
302696 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
302727 INFO: Bootloader c:\users\user\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
302728 INFO: checking EXE
302729 INFO: Building EXE because EXE-00.toc is non existent
302730 INFO: Building EXE from EXE-00.toc
302732 INFO: Appending archive to EXE C:\projects\py_ide\py_ide\build\py_ide\py_ide.exe
303116 INFO: Building EXE from EXE-00.toc completed successfully.
303164 INFO: checking COLLECT
303165 INFO: Building COLLECT because COLLECT-00.toc is non existent
303191 INFO: Building COLLECT COLLECT-00.toc
450752 INFO: Building COLLECT COLLECT-00.toc completed successfully.

和我的.spec文件:

# -*- mode: python -*-

block_cipher = None


a = Analysis(['C:/projects/py_ide/py_ide/__main__.py'],
             pathex=['C:\\projects\\py_ide\\py_ide'],
             binaries=[],
             datas=[('C:/projects/py_ide/py_ide', 'py_ide/')],
             hiddenimports=[],
             hookspath=[],
             runtime_hooks=[],
             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='py_ide',
          debug=False,
          bootloader_ignore_signals=False,
          strip=False,
          upx=True,
          console=True )
coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               strip=False,
               upx=True,
               name='py_ide')

0 个答案:

没有答案