What is the best way to compile a python script for an executable running on a linux (ubuntu), windows, and mac operating system.
What is the best way to compile a python script for an executable running on a linux (ubuntu), windows, and mac operating system.
On Windows you can compile Python .py scripts into .exe executables using Pyinstaller together with PyWin32:
Here are the links to the downloads:
Pyinstaller: link
PyWin32: link
You will be able to download the zipped Pyinstaller by simply splitting its folder and placing it inside the Pyhon folder.
The command to compile is as follows: (Where do you have ... you put the complete directory of where the Python folder is, Pyinstaller, example: C: \ Python3 \ pyinstaller-2.0 \ pyinstaller.py) p>
python C: ... \ pyinstaller.py script.py
You can also compile online at this following site: link
Using linux you can use the terminal.
python mycript.py
It is the most basic form, without using IDE. You can also specify the version of the interpreter. Here for example I use
python3 myScript.py
An alternative is to use the Jupyter Notebook where you can run a scrip line by line and go see the results.
Or using an IDE itself.