Reputation: 5036
Whenever I try to run a .py file from cmd it opens up in a text editor(np++). I'm trying to run the following:
django-admin.py startproject testprj
Even if I run 'setup.py install'
Upvotes: 5
Views: 10902
Reputation: 131677
You need to change the file association so that .py files open with Python executable, typically located in C:\Python<version>\
and not Notepad++
Changing this should be easy, but here is how to do it.
Also, read here on to set the environment path so that the Python executable is found without you having to navigate to C:\Python2.6.
Upvotes: 4
Reputation: 595
To extend the answers. After changing the default exec to open .py files, you might need to change scripts are opened, so that all the command line arguments are passed to the script. You can do it using Registry Editor (regedit).
Open Start Menu and type: regedit
In the editor go to:
Computer\HKEY_CLASSES_ROOT\Applications\py.exe\shell\open\command
modify the value to be equal to: C:\Windows\py.exe "%1" %*
Upvotes: 0
Reputation: 79921
Your Windows file associations are set to open .py
files in a text editor. You have to change those to use the python.exe
interpreter, or you can prefix all your commands with python, like this:
python django-admin.py startproject testprj
If you want to change your file associations, and you are running Vista or Windows 7, you can change them in 'Control Panel'->'Default Programs'->'Associate a file type or protocol with a program'
Upvotes: 1