文件目录
dir
├── csv_loader.py
├── labidus.py //主python
└── time_compare.py
1.生成主函数对应的spec文件
cd ~/Downloads/pyTool/labidus
pyi-makespec xx.py #这里xx替换成a,b,c 任意一个python文件,我们只是想生成一个spec
├── a.py
├── b.py
├── xx.spec
└── c.py
2.手动修改spec
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
SETUP_DIR = '/Users/jax/Downloads/pyTool/labidus' #位置
a = Analysis(
['b.py','b.py','c.py'],
pathex=[SETUP_DIR],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)
3.对spec文件进行pyinstaller安装
pyinstaller MMMM.spec
4.在同级目录下dist会生成打包好的tool
5.打包单个文件
pyinstaller -F xx.py
网友评论