简要说明:
Step1:安装pyinstaller
Step2:在Terminal中执行pyinstaller -F -w pyRun.py
详情如下:
(venv) D:\development\python_test_proj_2022\venv>pyinstaller -F -w pyRun.py
136 INFO: PyInstaller: 5.1
137 INFO: Python: 3.7.3
138 INFO: Platform: Windows-10-10.0.19041-SP0
139 INFO: wrote D:\development\python_test_proj_2022\venv\pyRun.spec
142 INFO: UPX is not available.
144 INFO: Extending PYTHONPATH with paths
['D:\development\python_test_proj_2022\venv']
503 INFO: checking Analysis
503 INFO: Building Analysis because Analysis-00.toc is non existent
503 INFO: Initializing module dependency graph...
505 INFO: Caching module graph hooks...
519 INFO: Analyzing base_library.zip ...
3447 INFO: Caching module dependency graph...
3667 INFO: running Analysis Analysis-00.toc
3679 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by D:\Program Files\Python\Python37-32\python.exe
3938 INFO: Analyzing D:\development\python_test_proj_2022\venv\pyRun.py
3984 INFO: Processing module hooks...
3985 INFO: Loading module hook 'hook-difflib.py' from 'd:\development\python_test_proj_2022\venv\lib\site-packages\PyInstaller\hooks'...
3988 INFO: Loading module hook 'hook-encodings.py' from 'd:\development\python_test_proj_2022\venv\lib\site-packages\PyInstaller\hooks'...
4080 INFO: Loading module hook 'hook-heapq.py' from 'd:\development\python_test_proj_2022\venv\lib\site-packages\PyInstaller\hooks'...
4082 INFO: Loading module hook 'hook-pickle.py' from 'd:\development\python_test_proj_2022\venv\lib\site-packages\PyInstaller\hooks'...
4083 INFO: Loading module hook 'hook-platform.py' from 'd:\development\python_test_proj_2022\venv\lib\site-packages\PyInstaller\hooks'...
4084 INFO: Loading module hook 'hook-xml.py' from 'd:\development\python_test_proj_2022\venv\lib\site-packages\PyInstaller\hooks'...
4309 INFO: Looking for ctypes DLLs
4310 INFO: Analyzing run-time hooks ...
4312 INFO: Including run-time hook 'd:\development\python_test_proj_2022\venv\lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_subprocess.py'
4315 INFO: Looking for dynamic libraries
5031 INFO: Looking for eggs
5031 INFO: Using Python library D:\Program Files\Python\Python37-32\python37.dll
5032 INFO: Found binding redirects:
[]
5034 INFO: Warnings written to D:\development\python_test_proj_2022\venv\build\pyRun\warn-pyRun.txt
5063 INFO: Graph cross-reference written to D:\development\python_test_proj_2022\venv\build\pyRun\xref-pyRun.html
5081 INFO: checking PYZ
5081 INFO: Building PYZ because PYZ-00.toc is non existent
5081 INFO: Building PYZ (ZlibArchive) D:\development\python_test_proj_2022\venv\build\pyRun\PYZ-00.pyz
5446 INFO: Building PYZ (ZlibArchive) D:\development\python_test_proj_2022\venv\build\pyRun\PYZ-00.pyz completed successfully.
5454 INFO: checking PKG
5454 INFO: Building PKG because PKG-00.toc is non existent
5454 INFO: Building PKG (CArchive) pyRun.pkg
7164 INFO: Building PKG (CArchive) pyRun.pkg completed successfully.
7167 INFO: Bootloader d:\development\python_test_proj_2022\venv\lib\site-packages\PyInstaller\bootloader\Windows-32bit\runw.exe
7167 INFO: checking EXE
7168 INFO: Building EXE because EXE-00.toc is non existent
7168 INFO: Building EXE from EXE-00.toc
7168 INFO: Copying bootloader EXE to D:\development\python_test_proj_2022\venv\dist\pyRun.exe.notanexecutable
7176 INFO: Copying icon to EXE
7179 INFO: Copying icons from ['d:\development\python_test_proj_2022\venv\lib\site-packages\PyInstaller\bootloader\images\icon-windowed.ico']
7180 INFO: Writing RT_GROUP_ICON 0 resource with 104 bytes
7180 INFO: Writing RT_ICON 1 resource with 3752 bytes
7181 INFO: Writing RT_ICON 2 resource with 2216 bytes
7181 INFO: Writing RT_ICON 3 resource with 1384 bytes
7181 INFO: Writing RT_ICON 4 resource with 38188 bytes
7181 INFO: Writing RT_ICON 5 resource with 9640 bytes
7181 INFO: Writing RT_ICON 6 resource with 4264 bytes
7182 INFO: Writing RT_ICON 7 resource with 1128 bytes
7185 INFO: Copying 0 resources to EXE
7185 INFO: Embedding manifest in EXE
7187 INFO: Updating manifest in D:\development\python_test_proj_2022\venv\dist\pyRun.exe.notanexecutable
7189 INFO: Updating resource type 24 name 1 language 0
7192 INFO: Appending PKG archive to EXE
9509 INFO: Building EXE from EXE-00.toc completed successfully.
(venv) D:\development\python_test_proj_2022\venv\dist>pyRun
(venv) D:\development\python_test_proj_2022\venv\dist>pyRun.exe