Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you make a Python executable file on Mac? [closed]

Tags:

python

macos

exe

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?

like image 474
dreamingthemaze Avatar asked Apr 11 '15 23:04

dreamingthemaze


People also ask

Where is Python executable file on Mac?

The Apple-provided build of Python is installed in /System/Library/Frameworks/Python. framework and /usr/bin/python , respectively.


1 Answers

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>
like image 62
Jawa Avatar answered Nov 04 '22 14:11

Jawa