8
如何将一个 Python 程序打包成 exe,同时又保留部分 Python 源码便于修改
source link: https://www.v2ex.com/t/789775
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
这个需求的目的是希望将一个项目的主体框架部分(不太需要被改动到)打包成 exe,同时包含各种依赖的库等,但是部分经常需要改动的代码还保留 python 源码的形式,exe 程序可以执行调用到这部分源码内容,这样的话既便于部署,又保持一定灵活性根据根据需求变化修改一些处理逻辑,是否有方法可以实现。
4 条回复 • 2021-07-15 22:53:27 +08:00
jim9606 1 小时 38 分钟前
用官方的 Windows embeddable package 改装。
将主体框架的包打包为 base.zip ,内容可为 py 或 pyc (参考官方的 python3x.zip 结构,不能包含 dll )放在目录内。
编辑 python3x._pth,将 base.zip 和可变源码包目录加进去。
将主体框架的包打包为 base.zip ,内容可为 py 或 pyc (参考官方的 python3x.zip 结构,不能包含 dll )放在目录内。
编辑 python3x._pth,将 base.zip 和可变源码包目录加进去。
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK