'Compile python file to executable [closed]
I'm looking for a compiler to compile '.py' file to a single '.exe' file.
I've try already auto-py-to-exe but I'm not happy with it.
I've tried PyInstaller, but one of its dependencies (PyCrypto, which I need) is not working/ maintained anymore and fails to install. https://pyinstaller.readthedocs.io/en/stable/usage.html#encrypting-python-bytecode
I've look also nuitka but it doesn't seem possible to set an icon for the exe.
Do you have any compiler recommendations that can obfuscate / encrypt the code to limit the reverse engineering?
Solution 1:[1]
I had a similar issue to this, needing to run Python code on machines where Python could not be downloaded.
I used py2exe, and it worked quite well. (https://www.py2exe.org/)
Solution 2:[2]
You could try these steps to convert .py to .exe in Python 3.8
- Install Python 3.8.
- Install cx_Freeze, (open your command prompt and type
pip install cx_Freeze. - Install idna, (open your command prompt and type
pip install idna. - Write a
.pya program namedmyfirstprog.py. - Create a new python file named
setup.pyon the current directory of your script. - In the
setup.pyfile, copy the code below and save it. - With shift pressed right click on the same directory, so you are able to open a command prompt window.
- In the prompt, type
python setup.py build - If your script is error-free, then there will be no problem with creating applications.
- Check the newly created folder
build. It has another folder in it. Within that folder, you can find your application. Run it. Make yourself happy.
See the original answer here.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | JimmyCarlos |
| Solution 2 | D. S. |
