Programs written in Python are typically published in the source code, so what if you don't want others to see the content?
The first method is to compile the code into a byte code, which is PYc file.
Executive: Python-m py_compile <filename>.py
Although this method can also hide the source code, but in fact can be decompile.
The second way is to use Cython to turn Python code into C language code and compile it into an executable program.
Method:
Install Cython First
Pip Install Cython
Installing the Python Development Kit
CentOS System: Yum install Python-devel
Ubuntu System: sudo apt-get install Python-dev
Convert Python code to C code:
Cython hello.py--embed
This will generate a hello.c C-language source file
Then use GCC to compile the binary executable, which requires the development of header files, compilation options, link Options
CentOS system: GCC ' python-config--cflags ' python-config--ldflags ' Hello.c-o Hello
If the Python version is high, you can use gcc ' python3-config--cflags--ldflags ' Hello.c-o Hello
So the code is compiled into a binary executable program.
Try to link the wrong words:
GCC ' python-config--cflags '-o hello hello.c ' python-config--ldflags '
Reference
If you are prompted for a connection error, the solution is here: http://stackoverflow.com/questions/13782618/python-py-initialize-unresolved-during-compilation