0

I have always used a mac to write and run python scripts. However, I have a bunch of files on a PC that I need to run a script on. I have never really used a PC and don't know how to run the script.

If I go to the command program on the PC and type in python, nothing happens. How do I find where the python path is in order to get into the python prompt? Also, once I am in the prompt, is the importing of modules the same as in a Unix system?

David542
  • 104,438
  • 178
  • 489
  • 842
  • 1
    Possible duplicate of [How do I run a python program in the Command Prompt in Windows 7?](http://stackoverflow.com/questions/4621255/how-do-i-run-a-python-program-in-the-command-prompt-in-windows-7) Once you get to the Python prompt, then module loading will work just like in *nix. – Cameron Feb 14 '12 at 18:20
  • 1
    "nothing happens"? Nothing at all? CMD.EXE crashes? Blue screen of death? What **actually** happens? – S.Lott Feb 14 '12 at 18:25
  • I hope you are using cmd.exe rather than command.com. – David Heffernan Feb 14 '12 at 18:55
  • maybe I am missing something, but...given a correct python installation you only need to double-click the script icon...that's all – joaquin Feb 14 '12 at 19:47

2 Answers2

3

Python isn't added to the system environment's PATH variable by default on windows. You have to either add the path to the directory containing the Python.exe file to the PATH variable, or call python explicitly.

This issue has been addressed in the Python documentation: Python Documentation: # How to run a Python program under windows

Nisan.H
  • 6,032
  • 2
  • 26
  • 26
1

Assuming Python is installed, it is usually placed in a folder prefixed with "Python" and the major/minor version. E.g. C:\Python26

Manfre
  • 1,235
  • 10
  • 10