How can I run python scripts on Windows?

4

I'm new to Windows 7 and with my Python installation. When I specify script.py in cmd.exe and hit Return/Enter, instead of executing the python file, I am given an error message (sth like "not a command").

How do I tell Windows to run the Python interpreter when specifying or double-clicking a Python script?

new

Posted 2010-06-22T08:20:32.280

Reputation: 41

Answers

5

Associate the .py extension with the python.exe interpreter executable. Normally the installer does this for you.

Ignacio Vazquez-Abrams

Posted 2010-06-22T08:20:32.280

Reputation: 100 516

Thanks, and here's how to: http://docs.python.org/faq/windows.html

– new – 2010-06-22T08:43:25.597

3I'd rather suggest to associate the .py extension with the pythonw.exe by default, to anticipate the question "It works now, but I don't want to see that cmd window." – vtest – 2010-06-22T11:21:43.613