个人技术分享

可以使用 PyInstaller 和 cx_Freeze 等工具将Python脚本打包成可执行文件。

PyInstaller

1. 安装PyInstaller

pip install pyinstaller

2. 打包Python脚本

pyinstaller --onefile your_script.py

--onefile 参数会告诉PyInstaller将所有的依赖打包进一个单独的可执行文件。这将生成一个dist文件夹,里面包含了你的可执行文件

--windowed--noconsole 参数生成一个不包含控制台窗口的可执行文件(适用于GUI应用)

pyinstaller --onefile --windowed app.py