
1. Compile the pyc file
Since the py file of the python program can easily leak the source code, python can be compiled into a secret pyc file.
The python pyc file is a binary file. After the py file becomes a pyc file, the loading speed is improved, and pyc is a cross-platform bytecode that is executed by the python virtual machine. This is similar. The concept of a virtual machine in JAVA or .NET.
How to compile py files into pyc files:
At the command line, type: python -m py_compile myFile.py to generate the corresponding pyc file. You can then execute the pyc file directly. Python myFile.pyc
2.1 Decompilation Tools
2.2 The most convenient is to use pip to install
Instructions
The executable file name I installed after installing pip on mac os,Wonderful, is there any?
View help
Decompile models.pyc into py files
Decompile all pyc files in the current folder to a source file with a .pyc_dis suffix
The effect of decompilation can be said to be ideal. If your code format meets the requirements of the PEP8 specification, it will be basically the same as the source file, but the various comments will be gone (cannot ask too high or not)
The last changed code has not been run (no pyc is generated), it is really lost, but not much, write it again!
The problem is solved, but in the end, I have to reflect on it. Be careful when using find + rm to delete files. Be sure to check again before confirming.
I hope to be helpful.
-