问题描述
我正在开发一个有趣的工具,我认为它具有很高的价值,并且可能最终希望开源.但是,在我决定之前,我想使其保持关闭"状态.
I am working on an interesting tool which I feel has good value and may eventually want to open source it. However, till I decide, I want to keep it "closed".
问题是我想用Python编写代码,这本质上意味着要交付代码.我知道我可以将Python代码转换为二进制代码,但是我想要可以在Windows/Linux/Mac上运行的东西
The problem is I want to code it in Python and this inherently means shipping the code. I know I can convert Python code into a binary but I want something which works across Windows / Linux / Mac
有人可以指出我该怎么做吗?
Can someone please point me to how this can be done?
推荐答案
好吧,Python是一种脚本语言,因此不太可能创建真实的.exe文件.
但是,您可能需要将代码编译为.pyc,然后分发您的应用程序.运行.pyc与常规python文件相同:
Well, Python is a scripting language, so it's not quite possible to create real .exe file.
However, you might want to compile your code to .pyc and then distribute your application. Running .pyc is the same as regular python file:
$ python code.pyc
compileall- http://docs.python.org/library/compileall.html#module-compileall
典型用法:
compileall - http://docs.python.org/library/compileall.html#module-compileall
Typical usage:
python -m compileall ./
我不确定反编译问题,但我认为这是可能的.Java .class文件也可以反编译.
I am not sure about decompilation issues, but I assume it's possible. Java .class files can be decompiled as well.
这篇关于将Python代码分发为Mac/Windows/Linux的可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!