Possible Duplicate:
How to make python scripts executable on Windows?
Set up Python on Windows to not type python in cmd
I have a python script under windows. Each time, I need to run using python *.py.
Can I run just as *.py without specify python?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Do you want to run it from the command line or the desktop?
If you set the file association for
.pyfiles (this is usually done during the install) you should be able to just double-click on the.pyfile on the desktop to get it to run.I don’t know of a way to avoid typing
pythonwith the command line (and this if it’s on the PATH already, otherwise one would have to specify the whole path to the python executable).It would be nice if we could do something similar like under Linux/Unix with
#/usr/bin/env pythondirective in the script, but I don’t think this exists for Windows unfortunately.You didn’t specify what version of Windows you are running, but in case you are interested in assigning/changing file associations, here are Microsoft’s instructions on doing that with XP. Very similar with other versions of Windows .. googling will bring up a bunch of hits for how to change file associations.