Python-docx 和 Pyinstaller 无法协同工作

Python-docx and Pyinstaller not working together

大家晚上好,我最近在 python 完成了一个应用程序,现在我正在使用 Pyinstaller 对其进行打包,但是在打包之后,我尝试使用该应用程序作为它的目的并生成一些报告,但是,它突然不能在 exe 文件中,但在文本编辑器中工作,并且由于某些奇怪的原因没有显示任何错误,我已经尝试 this thread 无济于事,我现在迷路了。

.spec 文件:

# -*- mode: python ; coding: utf-8 -*-
import sys
from os import path
site_packages = next(p for p in sys.path if 'site-packages' in p)
from kivy_deps import sdl2, glew

block_cipher = None


a = Analysis(['C:\Users\Admin\Newark\newarkp.py'],
             pathex=['C:\Users\Admin\Newark'],
             binaries=[],
             datas=[(path.join(site_packages,"docx","templates"), 
"docx/templates")],
             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='Newark',
          debug=False,
          bootloader_ignore_signals=False,
          strip=False,
          upx=True,
          console=True , icon='C:\Users\Admin\Newark\logo_icon.ico')
coll = COLLECT(exe, Tree('C:\Users\Admin\Newark\'),
               a.binaries,
               a.zipfiles,
               a.datas,
               *[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)],
               strip=False,
               name='Newark',
               upx=True,)

我为任何看到这个的人弄明白了,我的一些文件在打包过程中放错了地方,所以当我尝试使用它们时,他们使用了另一个无用的文件,结果什么也没发生。

打包后始终检查您的文件是否位于正确的目录中