pyinstaller打包的exe不能正常打开(本地调试正常)
如题,运行打包后的exe文件提示:Failed to execute script网上到处搜索过相关解决办法,还是未能解决。查看build文件夹中的warn.txt文件,内容显示为本帖最后显示:
小说明:
1. 本地代码文件调试一切正常。
2. 换了一台电脑生成exe正常。
3. 代码文件调用了turtle库,random库,math库,tk库(据错误信息显示,好像是模块文件丢失)
warm.txt显示错误信息如下:
This file lists modules PyInstaller was not able to find. This does not
necessarily mean this module is required for running you program. Python and
Python 3rd-party packages include a lot of conditional or optional modules. For
example the module 'ntpath' only exists on Windows, whereas the module
'posixpath' only exists on Posix systems.
Types if import:
* top-level: imported at the top-level - look at these first
* conditional: imported within an if-statement
* delayed: imported from within a function
* optional: imported within a try-except-statement
IMPORTANT: Do NOT post this list to the issue-tracker. Use it as a basis for
yourself tracking down the missing module. Thanks!
missing module named _posixsubprocess - imported by subprocess (conditional)
missing module named 'org.python' - imported by copy (optional), xml.sax (delayed, conditional)
missing module named pwd - imported by posixpath (delayed, conditional), shutil (optional), tarfile (optional), http.server (delayed, optional), webbrowser (delayed), netrc (delayed, conditional), getpass (delayed)
missing module named posix - imported by os (conditional, optional)
missing module named resource - imported by posix (top-level)
missing module named grp - imported by shutil (optional), tarfile (optional)
missing module named termios - imported by tty (top-level), getpass (optional)
missing module named vms_lib - imported by platform (delayed, conditional, optional)
missing module named 'java.lang' - imported by platform (delayed, optional), xml.sax._exceptions (conditional)
missing module named java - imported by platform (delayed)
missing module named _scproxy - imported by urllib.request (conditional)
missing module named _winreg - imported by platform (delayed, optional)
missing module named _frozen_importlib_external - imported by importlib._bootstrap (delayed), importlib (optional), importlib.abc (optional)
excluded module named _frozen_importlib - imported by importlib (optional), importlib.abc (optional)
missing module named readline - imported by cmd (delayed, conditional, optional), code (delayed, conditional, optional), pdb (delayed, optional)
missing module named org - imported by pickle (optional)
看看这篇文章行不行解决你的问题:
https://mp.weixin.qq.com/s/tCMj4r2NT5TaaJ5pNtgllA
感谢你的回答,但问题依旧 Twilight6 发表于 2021-6-9 09:24
看看这篇文章行不行解决你的问题:
https://mp.weixin.qq.com/s/tCMj4r2NT5TaaJ5pNtgllA
感谢你的回答,但问题依旧 haoi 发表于 2021-6-9 14:26
感谢你的回答,但问题依旧
那没办法了,去年遇到类似这个打包问题
半天没解决,放弃了 运行时报这类错误多数是你的代码中路径问题,也有可能是某个模块中的路径问题,因为经过pyinstaller打包后,某些路径属性会变,比如__file__,比如sys.executable等,不同的打包方式路径也有不一样,一两句话没法说清楚,而且这类报错跟你的代码关联性很强,没有实际操作很难定位问题点,如果一定要打包的话,建议先看看pyinstaller的官方文档中关于路径的那一部分。 好难啊,我也遇到这个问题,不知道怎么办
页:
[1]