pyinstaller打包python脚本的总结

1.安装pyinstaller
    pip install pyinstaller
2.安装pywin32
    下载二进制包:https://sourceforge.net/projects/pywin32/files/pywin32/Build%20221/
    二进制安装
3.开始制作
    进入C:\PythonXX\Scripts
    执行pyinstaller-script.py -F <待转换python的入口脚本全路径文件名>, 或者
    pyinstaller.exe -F <待转换python的入口脚本全路径文件名>
生成的exe文件在C:\PythonXX\Scripts\dist

如果出现很多错误,最后结尾是RecursionError: maximum recursion depth exceeded
解决方法是
到C:\PythonXX\Scripts目录找到待转换python文件同名的xxxx.spec文件
编辑这个文件,在第二行增加
import sys
sys.setrecursionlimit(5000)

然后执行pyinstaller-script.py xxx.spec或
pyinstaller.exe xxx.spec
 

猜你喜欢

转载自blog.csdn.net/abednego1979/article/details/82623989