Skip to main content
 首页 » 编程设计

python之如何将Python项目转换为可执行文件

2025年05月04日8thcjp

我有一个 Python 项目,我想将其转换为可执行文件。我已经安装了 Pyinstaller。我只知道如何将一个脚本转换为 .exe,但我有多个包含多个 python 脚本的包。

请您参考如下方法:

我成功使用的命令行是:

pyinstaller --noupx --onefile --add-data="cprofiles.ui;." cprofiles_lmfit.py 

pyinstaller 相对较好地管理您导入的多个“.py”文件,无需引用它们。在“添加数据”选项下,您列出了非 py 文件,在我的示例中,“cprofiles_lmfit.py”文件是包含主要文件的文件。

但如此处所示need help to compile python with pyinstaller (以及其他几篇文章),我是 pyinstaller 的初学者。我一直无法使用“theano”模块,也没有进行优化。我仍然需要测试答案中的建议。