I am developing a paid application in Python. I do not want the users to see the source code or decompile it. How can I accomplish this task of hiding the source code from the user, but running the code perfectly with the same performance?
You may distribute the compiled .pyc
files which is a byte code that the Python interpreter compiles your .py
files to.
More info on this found here on stackoverflow. How to compile all your project files .
This will somewhat hide your actual code into bytecode, but it can be disassembled. To prevent from disassembling you need to use obfuscation . Pyarmor might be something you're looking for.
You will definitely see the code if you're running it as a Python file. Maybe try using pyinstaller to make a executable binary for the respective Operating System that you're building for.
The best way would be to turn your python code into an executable file.
When u take a look here , there is a nice Tutorial on how to do it:
pip3 install pyinstaller
pyinstaller main.py
There is a lot of options to tweak the output of your application, the docs can be found under https://pyinstaller.org/en/stable/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.