Pyinstaller打包python文件

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_20965753/article/details/89224686

1. Pyinstaller打包python文件问题:

更新setuptools: pip install --upgrade setuptools
卸载enum34: pip uninstall enum34

2) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xce in position
cmd -> chcp 65001 -> pyinstaller -F xxx.py

3) ModuleNotFoundError: No module named 'pywt._extensions._cwt'
首先, 使用pyinstaller打包生成".spec"文件 -> 打开".spec"文件, 在hiddenimport=[]部分添加缺少的module, 如hiddenimport=["pywt","pywt._extensions._cwt"] -> 利用spec生成exe文件. pyinstaller *.spec

因此生成流程为: chcp 65001 -> pyinstaller -F xxx.py -> 修改spec文件 -> pyinstaller *.spec. 不加-w参数, -w参数错误不在命令行显示.

4) 运行exe文件时: cmd -> *.exe 接相应的参数.

猜你喜欢

转载自blog.csdn.net/qq_20965753/article/details/89224686