Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

Abhinav Ananth
Abhinav Ananth
488 Points

"Hello World" program not running

I wrote a sample program using the python IDLE for showing Hello world as the output using the print() function. but when i run the console and type python sample_program.py (I have saved the file as sample_program.py) it gives back the error message as follows: "python' is not recognized as an internal or external command, operable program or batch file." I saved the file on the desktop. I am running windows. What might be the issue?

1 Answer

Steven Parker
Steven Parker
229,708 Points

Windows doesn't come with Python. You'll need to download and install it if you want to run it on your local machine.

You can download Python for Windows here. Be sure to get Python 3.

If you have already installed it, perhaps its folder did not get added to your PATH system environment variable. If so, you may need to add it manually.

Abhinav Ananth
Abhinav Ananth
488 Points

I have already installed Python on my system. I already wrote that I had made the script on Python IDLE. There must be something else I might be doing wrong. I should open the console and type python sample_program.py to run the code or am I doing it wrong?

Steven Parker
Steven Parker
229,708 Points

I was updating my answer as you wrote that. Check the part about "path". :arrow_heading_up:

Abhinav Ananth
Abhinav Ananth
488 Points

Okay. Thanks for your help.