简体   繁体   English

如何将Python脚本编译成Unix可执行文件并使其不可读?

[英]How to compile a Python script into a Unix executable and make it unreadable?

I know I can make a Python script a unix executable by using #!/usr/bin/env python , but if I open the executable with any text editor, the code can be seen by everyone. 我知道我可以使用#!/usr/bin/env python使Python脚本成为unix可执行文件,但是如果我使用任何文本编辑器打开可执行文件,则每个人都可以看到该代码。

I want to compile a python script into a real unix executable, that means that it is compiled to Assembly and nobody can read its code, and decompiling is really hard in Assembly. 我想将python脚本编译成一个真正的unix可执行文件,这意味着它已被编译为Assembly,并且没有人可以读取其代码,而在Assembly中反编译确实很难。

I have seen Cython, which compiles Python code to C code, but it makes a .so (shared object) file, and cannot be executed, only imported. 我见过Cython,它将Python代码编译为C代码,但是它生成一个.so(共享对象)文件,并且无法执行,只能导入。

This could also be done if there was a tool that really generates C/C++ code, not a .so, so then, using any compiler such as gcc , compile the .c or .cpp file. 如果有一个工具真正生成C / C ++代码而不是.so,那么也可以这样做,因此,可以使用gcc之类的任何编译器来编译.c.cpp文件。 If this existed, it could also replace any other python compiler such as py2app , py2exe or any like that. 如果存在,它也可以替换任何其他python编译器,例如py2apppy2exe或类似的东西。

Is there a way to do this? 有没有办法做到这一点?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM