【发布时间】:2017-01-12 03:37:24
【问题描述】:
当我运行我的 py 程序时,它会按照我的预期工作。如果我在 Linux 机器上并使用 Pyinstaller 构建可执行文件,它会毫无问题地构建并毫无问题地执行。我已经搜索了 Pyinstaller 文档、git 等。发布的修复都没有帮助
我对 python 还是很陌生,感觉这可能是一个简单的修复,可能是过度思考这个问题
为什么我不能使用 pyinstaller 在基于 Windows 的系统上构建功能性 .exe?
Windows 10 系统
Pyinstaller 3.2 版
Python 版本 3.5.2
这是一个使用 appJar 的 GUI 程序,它也是最新的。
文件确实构建了,但出现“无法执行脚本”错误
编辑 不确定这是否最好像这样在线编辑,但是...... 所以研究输出并进行调整,问题似乎是appJar.py。出于某种原因,它缺少资产,我正在调查它。问题是我仍然不习惯看这种输出,不知道从哪里开始。
C:\Users\_User_>C:\temp\fileCreatorGUI\fileCreatorGUI.exe
Traceback (most recent call last):
File "F:\Users\_User_\python_working\fileCreatorGUI.py", line 73, in <module>
app = gui()
File "C:\Users\_User_\AppData\Local\Programs\Python\Python35\lib\site-packages\appJar\appjar.py", line 509, in __init__
self.topLevel.wm_iconbitmap(self.appJarIcon)
File "C:\Users\_User_\AppData\Local\Programs\Python\Python35\lib\tkinter\__init__.py", line 1716, in wm_iconbitmap
return self.tk.call('wm', 'iconbitmap', self._w, bitmap)
_tkinter.TclError: bitmap "C:\temp\fileCreatorGUI\appJar\resources\icons\favicon.ico" not defined
Failed to execute script fileCreatorGUI
编辑 2 请参阅下面的答案,但我在这棵树上叫错了树,
.dll 上的 Pyinstaller 输出阻塞:
api-ms-win-core-console-l1-1-0.dll
api-ms-win-core-datetime-l1-1-0.dll
(There are like ~40 of these)
我将这些 .dll 添加到 python 路径中,我在 .spec 文件的 bianaries 中声明了它们。
这是一个截断的日志:
2414 WARNING: Can not get binary dependencies for file: C:\Windows\system32\api-
ms-win-crt-stdio-l1-1-0.dll
Traceback (most recent call last):
File "C:\Users\_USER_NAME\AppData\Local\Programs\Python\Python35-32\lib\site-pa
ckages\PyInstaller\depend\bindepend.py", line 695, in getImports
return _getImports_pe(pth)
File "C:\Users\_USER_NAME\AppData\Local\Programs\Python\Python35-32\lib\site-pa
ckages\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
2423 WARNING: Can not get binary dependencies for file: C:\Windows\system32\api-
ms-win-crt-heap-l1-1-0.dll
我尝试了此处列出的修复: https://github.com/pyinstaller/pyinstaller/pull/1981
但这似乎并没有什么不同。
有人建议添加 sys.path.insert() 路由,但无论哪种方式都没有任何区别
我还在带有 Windows 7 的 VM 中尝试过这个,全新安装,没有变化。我的下一步是尝试在 Debian 中使用 Wine,但我真的不想走那条路。任何帮助,将不胜感激。谢谢
【问题讨论】:
标签: python dll pyinstaller