Pyinstaller 构建文件但在某些 .dll 上阻塞
Pyinstaller builds file but chokes on certain .dlls
当我 运行 我的 py 程序时,它按我预期的方式工作。如果我在 Linux 框上并使用 Pyinstaller 构建可执行文件,它可以毫无问题地构建并毫无问题地执行。我搜索了 Pyinstaller 文档 git 等。none 已发布的修复帮助
我在 python 还是个新手,觉得这可能是一个简单的修复,可能是我想多了这个问题
为什么我不能使用 pyinstaller 在基于 windows 的系统上构建功能性 .exe?
Windows10系统
Pyinstaller 版本 3.2
Python 版本 3.5.2
这是一个使用 appJar 的 GUI 程序,也是最新的。
文件确实生成了,但出现错误 "Could not execute script"
编辑
不确定这是否最好像这样在线编辑但是......
所以研究输出并进行调整,问题似乎是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
请参阅下面的答案,但我在这个树上咆哮错误,
Pyinstaller 输出在 .dll 上阻塞:
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 文件的二进制文件中声明了它们。
这里是一个运行分类日志:
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,但我真的不想走那条路。任何帮助,将不胜感激。谢谢
原来这是一个 appJar/packaging 问题,pyinstaller 没有在正确的目录中查找资产。根据 appJar 的开发,我注释掉了 appJar.py 中的两行代码,第 508-509 行:
if self.platform == self.WINDOWS:
self.topLevel.wm_iconbitmap(self.appJarIcon)
这里有更多细节:https://github.com/jarvisteach/appJar/issues/84
我可能可以通过在 pyinstaller 中使用 --path 参数来解决这个问题,但目前,这个问题已经完全解决了
当我 运行 我的 py 程序时,它按我预期的方式工作。如果我在 Linux 框上并使用 Pyinstaller 构建可执行文件,它可以毫无问题地构建并毫无问题地执行。我搜索了 Pyinstaller 文档 git 等。none 已发布的修复帮助
我在 python 还是个新手,觉得这可能是一个简单的修复,可能是我想多了这个问题
为什么我不能使用 pyinstaller 在基于 windows 的系统上构建功能性 .exe?
Windows10系统
Pyinstaller 版本 3.2
Python 版本 3.5.2
这是一个使用 appJar 的 GUI 程序,也是最新的。
文件确实生成了,但出现错误 "Could not execute script"
编辑 不确定这是否最好像这样在线编辑但是...... 所以研究输出并进行调整,问题似乎是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 请参阅下面的答案,但我在这个树上咆哮错误,
Pyinstaller 输出在 .dll 上阻塞:
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 文件的二进制文件中声明了它们。
这里是一个运行分类日志:
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,但我真的不想走那条路。任何帮助,将不胜感激。谢谢
原来这是一个 appJar/packaging 问题,pyinstaller 没有在正确的目录中查找资产。根据 appJar 的开发,我注释掉了 appJar.py 中的两行代码,第 508-509 行:
if self.platform == self.WINDOWS:
self.topLevel.wm_iconbitmap(self.appJarIcon)
这里有更多细节:https://github.com/jarvisteach/appJar/issues/84 我可能可以通过在 pyinstaller 中使用 --path 参数来解决这个问题,但目前,这个问题已经完全解决了