- 帖子
- 7
- 精华
- 0
- 积分
- 30
- 阅读权限
- 10
- 注册时间
- 2018-8-15
- 最后登录
- 2018-8-27
|
代码是那个课程中的猜数字游戏:
from random import randint
num=randint(22,122)
print('Guess what i think?')
bingo=False
while bingo == False:
answer=int(input('Please input number:'))
if answer<num:
print('too small')
if answer>num:
print('too big')
if answer==num:
print('bingo')
bingo=True
利用pyinstaller打包成exe文件:
D:\Python36\Scripts>pyinstaller -F Game1.py
91 INFO: PyInstaller: 3.3.1
91 INFO: Python: 3.6.4
93 INFO: Platform: Windows-10-10.0.17134-SP0
100 INFO: wrote D:\Python36\Scripts\Game1.spec
105 INFO: UPX is not available.
Traceback (most recent call last):
File "D:\Python36\Scripts\pyinstaller-script.py", line 11, in <module>
load_entry_point('PyInstaller==3.3.1', 'console_scripts', 'pyinstaller')()
File "D:\Python36\lib\site-packages\PyInstaller\__main__.py", line 94, in run
run_build(pyi_config, spec_file, **vars(args))
File "D:\Python36\lib\site-packages\PyInstaller\__main__.py", line 46, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "D:\Python36\lib\site-packages\PyInstaller\building\build_main.py", line 791, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "D:\Python36\lib\site-packages\PyInstaller\building\build_main.py", line 737, in build
exec(text, spec_namespace)
File "<string>", line 16, in <module>
File "D:\Python36\lib\site-packages\PyInstaller\building\build_main.py", line 162, in __init__
raise ValueError("script '%s' not found" % script)
ValueError: script 'D:\Python36\Scripts\Game1.py' not found
D:\Python36\Scripts>pyinstaller -F C:\Users\Daniel\Desktop\py_learn\Game1.py
91 INFO: PyInstaller: 3.3.1
91 INFO: Python: 3.6.4
94 INFO: Platform: Windows-10-10.0.17134-SP0
106 INFO: wrote D:\Python36\Scripts\Game1.spec
111 INFO: UPX is not available.
115 INFO: Extending PYTHONPATH with paths
['C:\\Users\\Daniel\\Desktop\\py_learn', 'D:\\Python36\\Scripts']
120 INFO: checking Analysis
120 INFO: Building Analysis because out00-Analysis.toc is non existent
121 INFO: Initializing module dependency graph...
126 INFO: Initializing module graph hooks...
129 INFO: Analyzing base_library.zip ...
3965 INFO: running Analysis out00-Analysis.toc
3970 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by D:\Python36\python.exe
4140 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of D:\Python36\python.exe
4285 WARNING: lib not found: api-ms-win-crt-locale-l1-1-0.dll dependency of D:\Python36\python.exe
4424 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of D:\Python36\python.exe
4567 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of D:\Python36\python.exe
4727 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of D:\Python36\python.exe
5004 WARNING: lib not found: api-ms-win-crt-filesystem-l1-1-0.dll dependency of D:\Python36\python36.dll
5148 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of D:\Python36\python36.dll
5286 WARNING: lib not found: api-ms-win-crt-locale-l1-1-0.dll dependency of D:\Python36\python36.dll
5430 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of D:\Python36\python36.dll
5582 WARNING: lib not found: api-ms-win-crt-conio-l1-1-0.dll dependency of D:\Python36\python36.dll
5739 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of D:\Python36\python36.dll
5894 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of D:\Python36\python36.dll
6034 WARNING: lib not found: api-ms-win-crt-process-l1-1-0.dll dependency of D:\Python36\python36.dll
6267 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of D:\Python36\python36.dll
6415 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of D:\Python36\python36.dll
6563 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of D:\Python36\python36.dll
6710 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of D:\Python36\python36.dll
6908 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of D:\Python36\VCRUNTIME140.dll
7090 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of D:\Python36\VCRUNTIME140.dll
7252 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of D:\Python36\VCRUNTIME140.dll
7413 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of D:\Python36\VCRUNTIME140.dll
7567 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of D:\Python36\VCRUNTIME140.dll
7576 INFO: Caching module hooks...
7582 INFO: Analyzing C:\Users\Daniel\Desktop\py_learn\Game1.py
7590 INFO: Loading module hooks...
7590 INFO: Loading module hook "hook-encodings.py"...
7741 INFO: Loading module hook "hook-pydoc.py"...
7742 INFO: Loading module hook "hook-xml.py"...
8017 INFO: Looking for ctypes DLLs
8018 INFO: Analyzing run-time hooks ...
8027 INFO: Looking for dynamic libraries
8178 WARNING: lib not found: api-ms-win-crt-filesystem-l1-1-0.dll dependency of D:\Python36\DLLs\_ssl.pyd
8330 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of D:\Python36\DLLs\_ssl.pyd
8530 WARNING: lib not found: api-ms-win-crt-conio-l1-1-0.dll dependency of D:\Python36\DLLs\_ssl.pyd
8683 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of D:\Python36\DLLs\_ssl.pyd
8854 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of D:\Python36\DLLs\_ssl.pyd
9011 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of D:\Python36\DLLs\_ssl.pyd
9166 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of D:\Python36\DLLs\_ssl.pyd
9338 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of D:\Python36\DLLs\_ssl.pyd
9520 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of D:\Python36\DLLs\_ssl.pyd
9677 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of D:\Python36\DLLs\_ssl.pyd
9837 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of D:\Python36\DLLs\unicodedata.pyd
10055 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of D:\Python36\DLLs\unicodedata.pyd
10227 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of D:\Python36\DLLs\unicodedata.pyd
10378 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of D:\Python36\DLLs\pyexpat.pyd
10537 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of D:\Python36\DLLs\pyexpat.pyd
10688 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of D:\Python36\DLLs\pyexpat.pyd
10835 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of D:\Python36\DLLs\pyexpat.pyd
11038 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of D:\Python36\DLLs\pyexpat.pyd
11210 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of D:\Python36\DLLs\_hashlib.pyd
11354 WARNING: lib not found: api-ms-win-crt-conio-l1-1-0.dll dependency of D:\Python36\DLLs\_hashlib.pyd
11506 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of D:\Python36\DLLs\_hashlib.pyd
11665 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of D:\Python36\DLLs\_hashlib.pyd
11835 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of D:\Python36\DLLs\_hashlib.pyd
11999 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of D:\Python36\DLLs\_hashlib.pyd
12146 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of D:\Python36\DLLs\_hashlib.pyd
12295 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of D:\Python36\DLLs\_hashlib.pyd
12453 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of D:\Python36\DLLs\_hashlib.pyd
12611 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of D:\Python36\DLLs\_bz2.pyd
12757 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of D:\Python36\DLLs\_bz2.pyd
12935 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of D:\Python36\DLLs\_bz2.pyd
13097 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of D:\Python36\DLLs\_bz2.pyd
13253 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of D:\Python36\DLLs\_bz2.pyd
13477 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of D:\Python36\DLLs\_lzma.pyd
13620 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of D:\Python36\DLLs\_lzma.pyd
13773 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of D:\Python36\DLLs\_socket.pyd
13920 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of D:\Python36\DLLs\_socket.pyd
14071 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of D:\Python36\DLLs\select.pyd
14077 INFO: Looking for eggs
14077 INFO: Using Python library D:\Python36\python36.dll
14078 INFO: Found binding redirects:
[]
14088 INFO: Warnings written to D:\Python36\Scripts\build\Game1\warnGame1.txt
14137 INFO: Graph cross-reference written to D:\Python36\Scripts\build\Game1\xref-Game1.html
14166 INFO: checking PYZ
14167 INFO: Building PYZ because out00-PYZ.toc is non existent
14168 INFO: Building PYZ (ZlibArchive) D:\Python36\Scripts\build\Game1\out00-PYZ.pyz
14787 INFO: Building PYZ (ZlibArchive) D:\Python36\Scripts\build\Game1\out00-PYZ.pyz completed successfully.
14802 INFO: checking PKG
14802 INFO: Building PKG because out00-PKG.toc is non existent
14802 INFO: Building PKG (CArchive) out00-PKG.pkg
17360 INFO: Building PKG (CArchive) out00-PKG.pkg completed successfully.
17370 INFO: Bootloader D:\Python36\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
17371 INFO: checking EXE
17373 INFO: Building EXE because out00-EXE.toc is non existent
17377 INFO: Building EXE from out00-EXE.toc
17378 INFO: Appending archive to EXE D:\Python36\Scripts\dist\Game1.exe
18051 INFO: Building EXE from out00-EXE.toc completed successfully.
之前打包出来不能运行,所以把pyinstaller卸载了,又用pip install --upgrade pyinstaller重新装一下
现在虽然还是出现lib not find: api-ms-....但能运行,为啥啊?
|
|