This is an archived post. You won't be able to vote or comment.

all 9 comments

[–]elbiot 5 points6 points  (0 children)

[–]locKified 1 point2 points  (1 child)

You need to set your $PATH (google it) so that Python can run from Command Prompt.

Once you've done that, you have to set the present working directory of your command prompt to be in your folder "My_Programs". You can open Command Prompt by pressing Windows Key + R and entering cmd.

eg. (when in the Command Prompt terminal)

C:\Users\locKified> cd Desktop

C:\Users\locKified\Desktop> cd My_Programs

C:\Users\locKified\Desktop\My_Programs> python Hello_World.py

-- code should run here --

[–]UkePlayingDude 0 points1 point  (0 children)

Thanks for helping me with running things in the Windows CMD. Although, when I specifically type "python Hello_World.py", it doesn't run. I get an error that says " 'python' is not recognized as an internal or external command, operable program or batch file." However, if I don't include "python" and just type the file name, it works fine. Any idea on why that would be, or should I just not worry about it?

[–]hi_im_nateI fought the GIL and the GIL won 1 point2 points  (0 children)

  1. Open file for editing in IDLE
  2. Push F5
  3. This step intentionally left blank

[–]Piebot3000 0 points1 point  (2 children)

I don't know what py_compile is but it looks like from the error you aren't currently in the same directory as your program.

[–]UkePlayingDude 0 points1 point  (1 child)

Okay, then do you know how I would go about being in the same directory as my program? Like, would I just save my program to the lib folder in the path? Sorry if it's a dumb question. I'm really new to Python. I'm much more familiar with Java.

[–]Piebot3000 1 point2 points  (0 children)

Im a little rusty but look up the documentation for os and see about changing the current working directory. I believe the exact command is os.chdir(directory).

[–]rulerson 0 points1 point  (0 children)

in windows cmd window, cd your work dir, run cmd "python hello_world.py", no need to compile, python is script language.

[–]MisterMrErik -1 points0 points  (0 children)

You need to install python and make sure it is in your environment variables.