I am running python 2.7, I can run a program fine when I open the *.py file.
But when I go to cmd and type “python *.py any other args“, it doesn’t work, it says that python is not recognised. This is hard because I am trying to do things like sys.argv[], any help is great.
Thanks
You probably don’t have the Python executable on your
PATH. The PATH variable tells the command interpreter where to find the commands you are issuing.If you are on a Unix/Linux system try
Under Windows it may vary, so find where Python (
python.exespecifically) was installed and specify that complete path to get the command to run. I think this will work though:c:\Python27\python.exeUnder Unix issue this command at the prompt:
Under Windows:
and it should run.
The long term solution is to add the Python directory to your PATH variable.
Since you are using Windows, this How to add python.exe to Windows PATH might be helpful. Or this page specifically for Windows 7.