Well, there are many possibilities to both do what you ask and to answer your question.
The simplest answer would be thus: On windows, with a Python interpreter installed, it registers the .py
, .pyc
and .pyo
file extensions to be opened using the told Python interpreter and thus you get a free "double-click-to-run" behavior.
On Linux, a similar behavior can be achieved by telling the loader which interpreter to use in order to run the script by adding the following line as the 1st line in the file:
#!/usr/bin/python -O
and marking it as an executable using chmod +x myfile.py
.
This will allow a user to run your file with a double-click from whatever file explorer he uses.
As for other possibilities, there are quite a few solutions, I'd recommend you to run a google search for it.
For Windows I'd recommend py2exe, and I'm not familiar with Linux solutions, and, anyway it was discussed on StackOverflow here
Best of luck!