1. 更新pip python -m pip install --upgrade pip; 2. 安装pipreqs, pyinstaller pip install pipreqs pyinstaller; 3. 执行命令, 将需要安装的依赖保存到 requirements.txt 中 pipreqs ./ ; 4. 安装依赖 pip install -r requirements.txt; 5. 进行打包 pyinstaller -F xxx.py