赞
踩
安装pyinstaller,按照命令提示安装成功,但打包文件的时候总是失败,如下:
错误提示:ValueError: script’C:\Users\Administrator\SevenDigitsDraw.py’ not found
刚开始我一直不理解,因为我明明安装pyinstaller成功了,但是打包文件一直这样。后来我又细看了上边的提示,以为是python版本与所安装的pyinstaller版本不一致造成的,但后来证明我是多想了…
话不多说,错误原因及解决方案:
(1)错误原因
我想打包的文件在E盘中,但我直接在C盘的情况下输入了“pyinstaller - F SevenDigitsDraw.py”,所以才导致文件找不到。
(2)解决办法
涉及到在windows命令行中换盘的问题,以我的E盘为例:
1、先将C盘换为E盘:直接输入“ e: ” ——>即转为E盘
C:\Users\Administrator>e:
2、接着输入自己所要打包文件所要的目录,一定要在前边加上cd!即**“ cd <文件夹名称>”**
E:\>cd python编程
3、开始打包——pyinstaller -F <文件名.py>,等待运行即可
4、恭喜你,打包成功!
33937 INFO: Appending archive to EXE E:\python编程\dist\SevenDigitsDraw.exe
34055 INFO: Building EXE from EXE-00.toc completed successfully.
ps:
前边那个图片是打包失败的情况
下边是Windows命令行成功输出的情况
Microsoft Windows [版本 10.0.18363.778] (c) 2019 Microsoft Corporation。保留所有权利。 C:\Users\Administrator>e: E:\>python编程 'python编程' 不是内部或外部命令,也不是可运行的程序 或批处理文件。 E:\>cd python编程 E:\python编程>pyinstaller -F SevenDigitsDraw.py 74 INFO: PyInstaller: 3.6 74 INFO: Python: 3.7.0 75 INFO: Platform: Windows-10-10.0.18362-SP0 106 INFO: wrote E:\python编程\SevenDigitsDraw.spec 107 INFO: UPX is not available. 111 INFO: Extending PYTHONPATH with paths ['E:\\python编程', 'E:\\python编程'] 111 INFO: checking Analysis 111 INFO: Building Analysis because Analysis-00.toc is non existent 111 INFO: Initializing module dependency graph... 154 INFO: Caching module graph hooks... 343 INFO: Analyzing base_library.zip ... 10311 INFO: Caching module dependency graph... 10733 INFO: running Analysis Analysis-00.toc 10970 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable required by d:\python\python37\python.exe 13734 INFO: Analyzing E:\python编程\SevenDigitsDraw.py 14448 INFO: Processing module hooks... 14449 INFO: Loading module hook "hook-encodings.py"... 14620 INFO: Loading module hook "hook-pydoc.py"... 14697 INFO: Loading module hook "hook-xml.py"... 15471 INFO: Loading module hook "hook-_tkinter.py"... 18882 INFO: checking Tree 18882 INFO: Building Tree because Tree-00.toc is non existent 18884 INFO: Building Tree Tree-00.toc 20992 INFO: checking Tree 20993 INFO: Building Tree because Tree-01.toc is non existent 20995 INFO: Building Tree Tree-01.toc 21340 INFO: Looking for ctypes DLLs 21350 INFO: Analyzing run-time hooks ... 21375 INFO: Including run-time hook 'pyi_rth__tkinter.py' 21442 INFO: Looking for dynamic libraries 22940 INFO: Looking for eggs 22940 INFO: Using Python library d:\python\python37\python37.dll 22940 INFO: Found binding redirects: [] 22968 INFO: Warnings written to E:\python编程\build\SevenDigitsDraw\warn-SevenDigitsDraw.txt 23111 INFO: Graph cross-reference written to E:\python编程\build\SevenDigitsDraw\xref-SevenDigitsDraw.html 23340 INFO: checking PYZ 23340 INFO: Building PYZ because PYZ-00.toc is non existent 23340 INFO: Building PYZ (ZlibArchive) E:\python编程\build\SevenDigitsDraw\PYZ-00.pyz 24363 INFO: Building PYZ (ZlibArchive) E:\python编程\build\SevenDigitsDraw\PYZ-00.pyz completed successfully. 24375 INFO: checking PKG 24375 INFO: Building PKG because PKG-00.toc is non existent 24376 INFO: Building PKG (CArchive) PKG-00.pkg 33872 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully. 33906 INFO: Bootloader d:\python\python37\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe 33906 INFO: checking EXE 33908 INFO: Building EXE because EXE-00.toc is non existent 33912 INFO: Building EXE from EXE-00.toc 33937 INFO: Appending archive to EXE E:\python编程\dist\SevenDigitsDraw.exe 34055 INFO: Building EXE from EXE-00.toc completed successfully. E:\python编程>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。