My google searching has failed me. I'd like to know how to make an executable Python file on OS X, that is, how to go about making an .exe file that can launch a Python script with a double click (not from the shell). For that matter I'd assume the solution for this would be similar between different scripting languages, is this the case?
The Apple-provided build of Python is installed in /System/Library/Frameworks/Python. framework and /usr/bin/python , respectively.
To make a script file (such as Python) executable from a shell, you need to include so called hash-bang line as the first line of the file (adjust to your location of python
binary):
#!/usr/local/bin/python
Then you also need to make the file executable by setting the execute bit by running e.g. chmod u+x <name_of_the_script.file>
.
After these steps you can run the program directly from Terminal.
./<name_of_the_script.file>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With