How to run Python from Windows cmd

I am trying to run a python program on Windows with a call like this:

python pacman.py

I have many such calls for a python program. I want to run it from a windows command prompt. When I run this on Ubuntu, it works well, but when I try to use it on Windows, I get the following error:

'python' is not recognized as an internal or external command, operable program or batch file.

How can I run these python programs from windows cmd?

+5
source share
4 answers

You need to change the Windows environment variable% PATH%. Under "My Computer" "Properties" ‣ "Advanced" environment variables, you must change the% PATH% variable to include your Python directory, that is, C: \ Python26.

: http://docs.python.org/2/using/windows.html#excursus-setting-environment-variables

+7

, Python . :

cd --> to pacman.py dir
C:\PythonVersion\python.exe pacman.py
+1

Just calling pacman.pyfrom the command line is enough if your windows are installed to open files .pywith python.exe. This is easy to do with the file manager. (And it is installed by default when installing python.)

0
source

Try using this, dir C: \ py *, this should give you a message similar to this "Volume on C: Windows Version --- Volume Serial Number C: Reference and" Python Path "where it is installed on your computer" if you get it, you are good to go ...

0
source

All Articles