python pyinstaller 打包


多次试验使用pip install pyinstaller安装pyinstaller在打包过程中均出现各种问题,直接在github下载源码打包

  1. 直接在github上下载源码git clone https://github.com/pyinstaller/pyinstaller.git

  2. 参照官方文档

Before using any contributed platform, you need to build the PyInstaller
bootloader, as we do not ship binary packages. Download PyInstaller
source, and build the bootloader::
     
        cd bootloader
        python ./waf distclean all

Then install PyInstaller::

        python setup.py install
        
or simply use it directly from the source (pyinstaller.py).
  1. 创建main.spec文件
# -*- mode: python -*-

block_cipher = None

#__packagename__ ='your package name'
__packagename__ ='wechat_auto_reply'

a = Analysis(['/path/file1.py','/path/file2.py'],
             pathex=['/path/pyinstaller-develop/' + __packagename__],
             binaries=[],
             datas=[],
             hiddenimports=[],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher,
             noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          a.binaries,
          a.zipfiles,
          a.datas,
          [],
          name= __packagename__,
          debug=False,
          strip=False,
          upx=True,
          runtime_tmpdir=None,
          console=True )
  1. 打包成可执行文件python3 pyinstaller.py main.spec
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容