我正在尝试打包我编写的python程序/脚本(pastebin link),其中包括一个使用tkinter模块的GUI。我决定使用Pyinstaller,根据他们的说法,它支持python3.7。在
安装程序当前正在尝试运行时,似乎没有问题。当我尝试运行可执行文件时,它失败了。我生成了一个单文件的可执行文件,它只需打开一个命令提示符并挂起。当我执行non-one file命令时,它会立即打开和关闭,但是会给出一个错误输出,由于关闭的速度很快,我看不到这个输出。我直接在cmd中打开了可执行文件来解决这个问题,它给出了一个错误:
C:\Users\mqian\Desktop\CGIProject\autoprimercode\windowsversion\build\windowsaut
oprimer>windowsautoprimer.exe
Error loading Python DLL 'C:\Users\mqian\Desktop\CGIProject\autoprimercode\windo
wsversion\build\windowsautoprimer\python37.dll'.
LoadLibrary: The specified module could not be found.
我不知道它是否应该在这个文件夹中查找python37.dll,但不管怎样,我有一个聪明的主意,把这个dll从python目录复制到跟踪指定的目录中(显然不应该是这样)。现在我得到的错误是:
^{pr2}$没完没了的谷歌搜索并没有产生任何具体的结果。以下是一些相关的链接,我想可能会有所帮助。在
https://github.com/pyinstaller/pyinstaller/issues/2149
https://www.xoolive.org/2015/09/09/issues-on-loading-dlls-with-pyinstaller.html
PyInstaller: "No module named Tkinter"
https://github.com/pyinstaller/pyinstaller/issues/2495
Error loading python27.dll error for pyinstaller
这是我的specfile文件:
# -*- mode: python -*-
block_cipher = None
a = Analysis(['windowsautoprimer.py'],
pathex=['C:\\Users\\mqian\\Desktop\\CGIProject\\autoprimercode\\windowsversion'],
binaries=[],
datas=[],
hiddenimports=['tkinter', 'Tkinter'],
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='windowsautoprimer',
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='windowsautoprimer')
有相同的问题,但后来意识到我无意中试图执行}文件夹中的文件。在
build
文件夹中的文件,而不是{看起来您在回溯过程中可能犯了同样的错误,所以看看使用
dist
中的可执行文件是否不能修复它相关问题 更多 >
编程相关推荐