pip install pyinstaller
或pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyinstaller
记得先切换到当前目录
然后运行指令
C:\Users\SIQI\Desktop\labelImg(wei)\labelImg>pyinstaller -F labelImg.py
C:\Users\SIQI\Desktop\labelImg(wei)\labelImg>pyinstaller -F labelImg.py
70 INFO: PyInstaller: 3.6
71 INFO: Python: 3.6.8
73 INFO: Platform: Windows-10-10.0.16299-SP0
74 INFO: wrote C:\Users\SIQI\Desktop\labelImg(wei)\labelImg\labelImg.spec
88 INFO: UPX is not available.
93 INFO: Extending PYTHONPATH with paths
['C:\\Users\\SIQI\\Desktop\\labelImg(wei)',
'C:\\Users\\SIQI\\Desktop\\labelImg(wei)\\labelImg']
93 INFO: checking Analysis
93 INFO: Building Analysis because Analysis-00.toc is non existent
93 INFO: Initializing module dependency graph...
97 INFO: Caching module graph hooks...
105 INFO: Analyzing base_library.zip ...
3620 INFO: Caching module dependency graph...
3840 INFO: running Analysis Analysis-00.toc
3852 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by d:\20191031_tensorflow_yolov3\python\python.exe
3994 INFO: Analyzing C:\Users\SIQI\Desktop\labelImg(wei)\labelImg\labelImg.py
4036 INFO: Processing pre-find module path hook distutils
4037 INFO: distutils: retargeting to non-venv dir 'd:\\20191031_tensorflow_yolov3\\python\\lib'
4386 INFO: Processing module hooks...
4386 INFO: Loading module hook "hook-distutils.py"...
4388 INFO: Loading module hook "hook-encodings.py"...
4667 INFO: Loading module hook "hook-lxml.etree.py"...
4668 INFO: Loading module hook "hook-pydoc.py"...
4669 INFO: Loading module hook "hook-PyQt5.py"...
4917 INFO: Loading module hook "hook-PyQt5.QtCore.py"...
5046 INFO: Loading module hook "hook-PyQt5.QtGui.py"...
5341 INFO: Loading module hook "hook-PyQt5.QtWidgets.py"...
5804 INFO: Loading module hook "hook-xml.etree.cElementTree.py"...
5804 INFO: Loading module hook "hook-xml.py"...
6050 INFO: Looking for ctypes DLLs
6050 INFO: Analyzing run-time hooks ...
6054 INFO: Including run-time hook 'pyi_rth_pyqt5.py'
6058 INFO: Looking for dynamic libraries
7803 INFO: Looking for eggs
7803 INFO: Using Python library d:\20191031_tensorflow_yolov3\python\python36.dll
7807 INFO: Found binding redirects:
[]
7812 INFO: Warnings written to C:\Users\SIQI\Desktop\labelImg(wei)\labelImg\build\labelImg\warn-labelImg.txt
7850 INFO: Graph cross-reference written to C:\Users\SIQI\Desktop\labelImg(wei)\labelImg\build\labelImg\xref-labelImg.html
7876 INFO: checking PYZ
7877 INFO: Building PYZ because PYZ-00.toc is non existent
7879 INFO: Building PYZ (ZlibArchive) C:\Users\SIQI\Desktop\labelImg(wei)\labelImg\build\labelImg\PYZ-00.pyz
8347 INFO: Building PYZ (ZlibArchive) C:\Users\SIQI\Desktop\labelImg(wei)\labelImg\build\labelImg\PYZ-00.pyz completed successfully.
8367 INFO: checking PKG
8367 INFO: Building PKG because PKG-00.toc is non existent
8370 INFO: Building PKG (CArchive) PKG-00.pkg
24303 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
24307 INFO: Bootloader d:\20191031_tensorflow_yolov3\python\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
24308 INFO: checking EXE
24309 INFO: Building EXE because EXE-00.toc is non existent
24310 INFO: Building EXE from EXE-00.toc
24312 INFO: Appending archive to EXE C:\Users\SIQI\Desktop\labelImg(wei)\labelImg\dist\labelImg.exe
24372 INFO: Building EXE from EXE-00.toc completed successfully.
C:\Users\SIQI\Desktop\labelImg(wei)\labelImg>
参考文章:Python3.7将代码打包成exe程序并添加图标,一分钟学会!