Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
215,959 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
215,959 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.