• Python | 用Pyinstaller打包发布exe应用


    参考:https://jingyan.baidu.com/article/a378c960b47034b3282830bb.html

    https://ask.csdn.net/questions/720080

    https://blog.csdn.net/solarnanocar/article/details/82077484(如果不需要转化成单个exe文件,单单此条即可,亲测有效)

    https://www.cnblogs.com/gopythoner/p/6337543.html

    https://jingyan.baidu.com/article/bad08e1ed173d409c85121f8.html

    需打包程序参考:https://www.cnblogs.com/msxh/p/4966899.html

    D:pythonWorkspace	est>pyinstaller.exe -F -w testa.py
    74 INFO: PyInstaller: 3.4
    74 INFO: Python: 3.7.2
    75 INFO: Platform: Windows-10-10.0.16299-SP0
    76 INFO: wrote D:pythonWorkspace	est	esta.spec
    80 INFO: UPX is not available.
    82 INFO: Extending PYTHONPATH with paths
    ['D:\pythonWorkspace\test', 'D:\pythonWorkspace\test']
    82 INFO: checking Analysis
    87 INFO: Building because D:pythonWorkspace	est	esta.py changed
    87 INFO: Initializing module dependency graph...
    89 INFO: Initializing module graph hooks...
    91 INFO: Analyzing base_library.zip ...
    2803 INFO: running Analysis Analysis-00.toc
    2806 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
      required by d:pythonpython.exe
    3558 INFO: Caching module hooks...
    3563 INFO: Analyzing D:pythonWorkspace	est	esta.py
    3788 INFO: Processing pre-find module path hook   distutils
    3820 INFO: Loading module hooks...
    3820 INFO: Loading module hook "hook-distutils.py"...
    3823 INFO: Loading module hook "hook-encodings.py"...
    3908 INFO: Loading module hook "hook-pkg_resources.py"...
    4162 INFO: Processing pre-safe import module hook   win32com
    4468 INFO: Loading module hook "hook-pydoc.py"...
    4469 INFO: Loading module hook "hook-pygame.py"...
    4470 WARNING: Hidden import "pygame._view" not found!
    4470 INFO: Loading module hook "hook-pythoncom.py"...
    4711 INFO: Loading module hook "hook-pywintypes.py"...
    4955 INFO: Loading module hook "hook-sysconfig.py"...
    4957 INFO: Loading module hook "hook-win32com.py"...
    5407 INFO: Loading module hook "hook-xml.py"...
    5630 INFO: Looking for ctypes DLLs
    5642 INFO: Analyzing run-time hooks ...
    5645 INFO: Including run-time hook 'pyi_rth_pkgres.py'
    5648 INFO: Including run-time hook 'pyi_rth_win32comgenpy.py'
    5655 INFO: Looking for dynamic libraries
    7280 INFO: Looking for eggs
    7281 INFO: Using Python library d:pythonpython37.dll
    7281 INFO: Found binding redirects:
    []
    7289 INFO: Warnings written to D:pythonWorkspace	estuild	estawarn-testa.txt
    7344 INFO: Graph cross-reference written to D:pythonWorkspace	estuild	estaxref-testa.html
    7353 INFO: checking PYZ
    7356 INFO: Building because toc changed
    7357 INFO: Building PYZ (ZlibArchive) D:pythonWorkspace	estuild	estaPYZ-00.pyz
    7953 INFO: Building PYZ (ZlibArchive) D:pythonWorkspace	estuild	estaPYZ-00.pyz completed successfully.
    7960 INFO: checking PKG
    7962 INFO: Building because toc changed
    7962 INFO: Building PKG (CArchive) PKG-00.pkg
    11987 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
    11993 INFO: Bootloader d:pythonlibsite-packagesPyInstallerootloaderWindows-64bit
    unw.exe
    11993 INFO: checking EXE
    11994 INFO: Rebuilding EXE-00.toc because testa.exe missing
    11995 INFO: Building EXE from EXE-00.toc
    11998 INFO: Appending archive to EXE D:pythonWorkspace	estdist	esta.exe
    12012 INFO: Building EXE from EXE-00.toc completed successfully.

    执行后能在下图路径中的dist文件夹内生成一个exe应用程序,我的是win10系统,经实验,这个应用程序在其他的win10电脑中可以运行,但在win7里不行,若有大神有解决方法,欢迎指点~

    D:pythonWorkspace	est>pyinstaller -D -w testa.py
    71 INFO: PyInstaller: 3.4
    71 INFO: Python: 3.7.2
    72 INFO: Platform: Windows-10-10.0.16299-SP0
    76 INFO: wrote D:pythonWorkspace	est	esta.spec
    82 INFO: UPX is not available.
    84 INFO: Extending PYTHONPATH with paths
    ['D:\pythonWorkspace\test', 'D:\pythonWorkspace\test']
    84 INFO: checking Analysis
    109 INFO: checking PYZ
    124 INFO: checking PKG
    124 INFO: Bootloader d:pythonlibsite-packagesPyInstallerootloaderWindows-64bit
    unw.exe
    124 INFO: checking EXE
    124 INFO: Building because console changed
    124 INFO: Building EXE from EXE-00.toc
    124 INFO: Appending archive to EXE D:pythonWorkspace	estuild	esta	esta.exe
    140 INFO: Building EXE from EXE-00.toc completed successfully.
    140 INFO: checking COLLECT
    WARNING: The output directory "D:pythonWorkspace	estdist	esta" and ALL ITS CONTENTS will be REMOVED! Continue? (y/n)y
    6765 INFO: Removing dir D:pythonWorkspace	estdist	esta
    6859 INFO: Building COLLECT COLLECT-00.toc
    7280 INFO: Building COLLECT COLLECT-00.toc completed successfully.

    执行后,可在上图路径中的dist文件夹内生成一个testa文件夹,经压缩后就可发给他人电脑中运行了,我win10的系统发到win7上可以运行

    如果有你有其他的素材包,得把素材包复制到新生成的文件夹内,本人还不知道如何把素材包一起转化成单一的exe文件,望有路过的大神指点~

  • 相关阅读:
    什么叫委托
    什么是继承
    什么叫多态
    委托的了解
    什么是数组
    工作记录之 oracle去重的三个方法
    实例分析J2ME网络编程的两种方法
    在无线J2ME设备上实现超文本传输协议
    java与C、C++进行通信的一些问题
    如何配置Wiindows live writer
  • 原文地址:https://www.cnblogs.com/hemeiwolong/p/10353497.html
Copyright © 2020-2023  润新知