python, pyinstaller 打包找不到自身文件

qq_43086055 2019-01-11 02:03:32

直接用pyinstaller 打包一个自己编写的文件,pyinstaller报找不到这个文件自身,不知道是什么问题。
注python的 环境变量和pyinstaller都是正确的,编译其它可以程序没问题

版本和错误信息见下

在该文件目录下运行命令:pyinstaller excel.py


77 INFO: PyInstaller: 3.4
78 INFO: Python: 3.6.8
78 INFO: Platform: Windows-10-10.0.17134-SP0
79 INFO: wrote F:\My\myprog\excel\release\excel.spec
86 INFO: UPX is not available.
88 INFO: Extending PYTHONPATH with paths
['F:\\My\\myprog\\excel\\release', 'F:\\My\\myprog\\excel\\release']
88 INFO: checking Analysis
105 INFO: Building because inputs changed
106 INFO: Initializing module dependency graph...
108 INFO: Initializing module graph hooks...
111 INFO: Analyzing base_library.zip ...
3531 INFO: running Analysis Analysis-00.toc
3534 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by e:\users\appdata\local\programs\python\python36-32\python.exe
4369 INFO: Caching module hooks...
4377 INFO: Analyzing F:\My\myprog\excel\release\excel.py
。。。。。。
36781 INFO: checking PYZ
36791 INFO: Building because toc changed
36791 INFO: Building PYZ (ZlibArchive) F:\My\myprog\excel\release\build\excel\PYZ-00.pyz
38532 INFO: Building PYZ (ZlibArchive) F:\My\myprog\excel\release\build\excel\PYZ-00.pyz completed successfully.
38564 INFO: checking PKG
38564 INFO: Building PKG because PKG-00.toc is non existent
38564 INFO: Building PKG (CArchive) PKG-00.pkg
Traceback (most recent call last):
File "E:\Users\AppData\Local\Programs\Python\Python36-32\Scripts\pyinstaller-script.py", line 11, in <module>
load_entry_point('PyInstaller==3.4', 'console_scripts', 'pyinstaller')()
File "E:\Users\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\PyInstaller\__main__.py", line 111, in run
run_build(pyi_config, spec_file, **vars(args))
File "E:\Users\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\PyInstaller\__main__.py", line 63, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "E:\Users\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\PyInstaller\building\build_main.py", line 838, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "E:\Users\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\PyInstaller\building\build_main.py", line 784, in build
exec(text, spec_namespace)
File "<string>", line 29, in <module>
File "E:\Users\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\PyInstaller\building\api.py", line 424, in __init__
strip_binaries=self.strip, upx_binaries=self.upx,
File "E:\Users\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\PyInstaller\building\api.py", line 196, in __init__
self.__postinit__()
File "E:\Users\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\PyInstaller\building\datastruct.py", line 158, in __postinit__
self.assemble()
File "E:\Users\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\PyInstaller\building\api.py", line 281, in assemble
pylib_name=pylib_name)
File "E:\Users\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\PyInstaller\archive\writers.py", line 334, in __init__
super(CArchiveWriter, self).__init__(archive_path, logical_toc)
File "E:\Users\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\PyInstaller\archive\writers.py", line 61, in __init__
self._add_from_table_of_contents(logical_toc)
File "E:\Users\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\PyInstaller\archive\writers.py", line 86, in _add_from_table_of_contents
self.add(toc_entry) # The guts of the archive.
File "E:\Users\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\PyInstaller\archive\writers.py", line 375, in add
code = get_code_object(nm, pathnm)
File "E:\Users\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\PyInstaller\building\utils.py", line 627, in get_code_object
raise ValueError("Module file %s is missing" % filename)
ValueError: Module file F:\My\myprog\excel\release\excel.py is missing

...全文
1327 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq_43086055 2019-01-11
  • 打赏
  • 举报
回复
重启也没用,崩溃
陈年椰子 2019-01-11
  • 打赏
  • 举报
回复
如果以前都可以的。
重启下电脑试试
qq_43086055 2019-01-11
  • 打赏
  • 举报
回复
路径是正常的,刚重新安装了pyinstaller 还是报这个错误
陈年椰子 2019-01-11
  • 打赏
  • 举报
回复
那就检查下 python 相关路径是否包含到环境变量里, 重新安装下 pyinstaller 试试。
qq_43086055 2019-01-11
  • 打赏
  • 举报
回复
刚用其他文件试了下发现也报这个错误。。 很奇怪,以前打包都是正常的
陈年椰子 2019-01-11
  • 打赏
  • 举报
回复
如果就这个文件, 而且 python excel.py 能成功。 那要研究下 excel.py 里面import 了哪些文件。 看是否都在缺省目录下。
陈年椰子 2019-01-11
  • 打赏
  • 举报
回复
就这个py文件出错,其他文件没问题?
陈年椰子 2019-01-11
  • 打赏
  • 举报
回复
pyinstaller -F excel.py

这样执行能成功吗?

37,720

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • IT.BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧