python3.6使用pyinstaller打包成exe

  1. 下载pyinstaller
         pip install pyinstaller

2、将需要打包的文件放到一个目录中
python3.6使用pyinstaller打包成exe_第1张图片
3、执行命令 pyinstaller -F -c ora_to_excel.py
参数说明: -F 创建一个exe文件
-c 使用控制台,不使用窗口

 F:\文档\python\package>pyinstaller -F -c ora_to_excel.py
69 INFO: PyInstaller: 3.4
69 INFO: Python: 3.6.3
70 INFO: Platform: Windows-7-6.1.7601-SP1
70 INFO: wrote F:\文档\python\package\ora_to_excel.spec
77 INFO: UPX is not available.
79 INFO: Extending PYTHONPATH with paths
['F:\\文档\\python\\package', 'F:\\文档\\python\\package']
79 INFO: checking Analysis
79 INFO: Building Analysis because Analysis-00.toc is non existent
79 INFO: Initializing module dependency graph...
81 INFO: Initializing module graph hooks...
83 INFO: Analyzing base_library.zip ...
3251 INFO: running Analysis Analysis-00.toc
3254 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of f
inal executable
  required by c:\users\thinkpad\appdata\local\programs\python\python36\python.ex
e
3502 INFO: Caching module hooks...
3507 INFO: Analyzing F:\文档\python\package\ora_to_excel.py
3643 INFO: Processing pre-find module path hook   distutils
3713 INFO: Processing pre-safe import module hook   win32com
5638 INFO: Loading module hooks...
5639 INFO: Loading module hook "hook-cx_Oracle.py"...
5640 INFO: Loading module hook "hook-distutils.py"...
5641 INFO: Loading module hook "hook-encodings.py"...
5746 INFO: Loading module hook "hook-PIL.Image.py"...
6146 INFO: Loading module hook "hook-PIL.py"...
6148 INFO: Import to be excluded not found: 'FixTk'
6148 INFO: Excluding import 'PyQt5'
6150 INFO:   Removing import of PyQt5 from module PIL.ImageQt
6151 INFO: Excluding import 'PySide'
6152 INFO:   Removing import of PySide from module PIL.ImageQt
6153 INFO: Excluding import 'PyQt4'
6154 INFO:   Removing import of PyQt4 from module PIL.ImageQt
6155 INFO: Excluding import 'tkinter'
6157 INFO:   Removing import of tkinter from module PIL.ImageTk
6157 INFO: Loading module hook "hook-PIL.SpiderImagePlugin.py"...
6158 INFO: Import to be excluded not found: 'FixTk'
6158 INFO: Excluding import 'tkinter'
6159 INFO: Loading module hook "hook-pydoc.py"...
6160 INFO: Loading module hook "hook-pythoncom.py"...
6438 INFO: Loading module hook "hook-pywintypes.py"...
6720 INFO: Loading module hook "hook-win32com.py"...
6721 INFO: Loading module hook "hook-xml.py"...
6950 INFO: Loading module hook "hook-_tkinter.py"...
7124 INFO: checking Tree
7124 INFO: Building Tree because Tree-00.toc is non existent
7124 INFO: Building Tree Tree-00.toc
7346 INFO: checking Tree
7346 INFO: Building Tree because Tree-01.toc is non existent
7346 INFO: Building Tree Tree-01.toc
7393 INFO: Looking for ctypes DLLs
7494 WARNING: library coredll required via ctypes not found
7500 INFO: Analyzing run-time hooks ...
7504 INFO: Including run-time hook 'pyi_rth_win32comgenpy.py'
7511 INFO: Looking for dynamic libraries
7804 INFO: Looking for eggs
7804 INFO: Using Python library c:\users\thinkpad\appdata\local\programs\python\
python36\python36.dll
7804 INFO: Found binding redirects:
[]
7809 INFO: Warnings written to F:\文档\python\package\build\ora_to_excel\warn-or
a_to_excel.txt
7874 INFO: Graph cross-reference written to F:\文档\python\package\build\ora_to_
excel\xref-ora_to_excel.html
7889 INFO: checking PYZ
7889 INFO: Building PYZ because PYZ-00.toc is non existent
7889 INFO: Building PYZ (ZlibArchive) F:\文档\python\package\build\ora_to_excel\
PYZ-00.pyz
8633 INFO: Building PYZ (ZlibArchive) F:\文档\python\package\build\ora_to_excel\
PYZ-00.pyz completed successfully.
8645 INFO: checking PKG
8646 INFO: Building PKG because PKG-00.toc is non existent
8646 INFO: Building PKG (CArchive) PKG-00.pkg
11857 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
11861 INFO: Bootloader c:\users\thinkpad\appdata\local\programs\python\python36\
lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
11861 INFO: checking EXE
11861 INFO: Building EXE because EXE-00.toc is non existent
11861 INFO: Building EXE from EXE-00.toc
11862 INFO: Appending archive to EXE F:\文档\python\package\dist\ora_to_excel.ex
e
11873 INFO: Building EXE from EXE-00.toc completed successfully.

4、执行命令完成后,进入dist目录,就可以看到生成了exe文件

F:\文档\python\package>cd dist

F:\文档\python\package\dist>dir
 驱动器 F 中的卷没有标签。
 卷的序列号是 E290-1025

 F:\文档\python\package\dist 的目录

2019-06-27  09:51              .
2019-06-27  09:51              ..
2019-06-27  09:51        11,586,642 ora_to_excel.exe
               1 个文件     11,586,642 字节
               2 个目录 111,620,251,648 可用字节
   

参考:https://blog.csdn.net/lqzdreamer/article/details/77917493

你可能感兴趣的:(python3.6使用pyinstaller打包成exe)