I'm making a very simple python code , it asks you some questions and then restarts your pc based on the answers i want to send it to some friends but i don't want them to read the code before they run it how can i encrypt the .py file so you can only run it but can't read or edit it ?
Asked
Active
Viewed 658 times
-1
-
You might want to convert it to an exe file, it would be in binary then – marsnebulasoup Jun 09 '19 at 18:11
-
Check out cx freeze – marsnebulasoup Jun 09 '19 at 18:12
-
https://pypi.org/project/auto-py-to-exe/ ? – Caius Jard Jun 09 '19 at 18:12
-
but i want it to be .py file is that possible? – Ahmed Rmdan Jun 09 '19 at 18:13
-
https://stackoverflow.com/a/7418341 – marsnebulasoup Jun 09 '19 at 18:14
-
Also this: https://stackoverflow.com/a/42094534/8402369 – marsnebulasoup Jun 09 '19 at 18:17
-
Check the above links out. They might work for you – marsnebulasoup Jun 13 '19 at 06:23
1 Answers
1
You can run this command
python -m py_compile fileA.py fileB.py fileC.py
It will compile all 3 named files. Replace fileA.py, etc. with your python files.
Afterwards you can run it with python just like usually.
Source: https://askubuntu.com/questions/324871/how-to-compile-a-python-file

Keyinator
- 111
- 2
- 10