Python On XP: 7 Minutes To “Hello World!”

by Richard Dooling on March 14, 2006

“Python Foot” graphic by David Day.

dday.com

How To Install Python On Windows XP

Instead of being all things to all users, this little how-to assumes the following:

  • You are a Windows XP user who is curious about computer programming;
  • You would like to install the Python computer language on your Windows XP machine, start the Python interpreter, and run the classic “Hello World!” program.

These instructions seem to work just fine for Windows Vista and Windows 7, too. Leave a note if you are able to confirm or deny. I use Linux and Mac OS X now, so I can’t test myself. RD (last update – 2 July 2011)

If you have questions, like “What is Python and why should I install it on my Windows XP computer?” go read Why Python on Windows XP? Come back if you want to install Python.

Back already? Never left? Okay, proceed.

A company called ActiveState makes a free, all-in-one Python distribution that has everything you need to run Python on Windows.

I don’t work for ActiveState. I am not an affiliate. There is no affiliate id or code in the link I provide to their site. I get no fee or percentage from them. I am not a computer expert, nor am I a computer scientist, just a Python fan.

Ready? Assuming you have cable or DSL, you are less than seven minutes away from having Python installed on your computer and typing your first command at the interpreter prompt. Go!

ActivePython

  • Python works on Windows, Macs, and Linux so you’ll see a page offering distributions and versions for all. However, ActiveState can tell if you are using Windows, so you’ll see ActiveState’s recommendation for you in the two blue bars at the top of the list:

Download Active Pythong

  • Unless you know you have a newer 64-bit machine, play it safe and click on the “x86″ 32-bit version. You’ll also notice newer distributions of Python listed farther down the page. For now, use the version recommended by ActiveState in the blue bars. You can come back later and install a newer distribution once you become a Python convert, but most tutorials for new users are still written for older Python versions, so be conservative for now.
  • When you click on the blue bar, Python should begin downloading.
  • Make a note of where you download this file on your computer. It takes a few minutes to complete the download. Pass the time by watching the “Bring Out Your Dead” scene from The Holy Grail. Done? Okay, go find the ActivePython file on your computer.
  • As of this writing, the file you downloaded is called “ActivePython-(your version number)-win32-x86.msi.” It’s about 45 megabytes, which is half the size of the last driver I installed for my Logitech Mouse.
  • Double-click on the ActivePython file. (Windows may ask you to acknowledge that the software maker is unknown.)
  • Up pops the ActiveState box and tells you it’s going to install ActivePython. Click Next.
  • Up pops the Licensing Agreement. Check the Accept box. Click Next.
  • Up pops a dialogue box allowing you to customize the installation. Don’t customize it. Click Next.
  • See the button that says “Install”? Click it.
  • You’re done, and the ActivePython User Guide appears.
  • Now go to START | All Programs | ActiveState ActivePython (version number) (32-bit)
  • The menu will break out into submenus. You want the one that says: “IDLE (Python GUI)” Click on it.
  • You are now at the command prompt of the Python interpreter and ready to speak Parseltongue.
  • Your cursor will be blinking just to the right of a prompt that looks like this: >>>
  • Type the following command there and make sure that “Hello World!” is inside quotation marks:
    >>> print “Hello World!”
  • Press Enter. You should see Hello World! appear in a different-colored font on the line below.
  • If so, you’re done!
  • If you get an error message that says: “SyntaxError: invalid syntax” then you either forgot the quotation marks or you installed Python version 3.0 or greater, which uses a different print command.1

Python Print Hello World

You are inside the Python shell window (a.k.a. interactive interpreter) of the Python IDE (Integrated Development Environment). Leave the Python interpreter open, ready, and waiting to take your commands. Go to one of the following tutorials, which will teach you how to use the Python interpreter to learn Python:

Once you become comfortable playing with the Python Interpreter, go to the BeginnersGuide/NonProgrammers page of the Python.org site and select more tutorials. There are plenty of good ones. All free!

You can help by leaving a note below, especially if you use Windows Vista or Windows 7. I try to keep this page current, so if you encounter any difficulties, please post below and I’ll try to address them. Thanks, RD

Later, when you start learning to program and have more questions, visit the Python Users Group at Google Groups and search it. Chances are your question has already been asked and answered. Also, when you need help remembering commands, refer to this excellent Python Quick Reference sheet. And be sure to visit the beautiful, new, SEARCHABLE Python documentation page from the busy geeks at Python.Org.

If you prefer learning from a good Python book, try this one:

After you acquire basic knowledge in Python, you can move onto some other great books:

  • The Python Cookbook, 2nd Ed., by Alex Martelli, Anna Ravenscroft and David Ascher, which provides “recipes” for common tasks you might like to accomplish using Python on your computer. For many people, this is the best way to learn code, by studying examples contained in programs that do useful work.
  • Learning Python, 4th Ed., by Mark Lutz, commonly considered the most thorough introduction to the language for beginners, now out in a new 3rd edition that covers Python 2.5 and looks ahead to Python 3.0.
  • Python: Essential Reference, 4th Ed., by David M. Beazley. This is the newest of the Python books and probably the best all-around Python book, but newbies may find it overly terse. Beazley wastes no words and has a tight, crisp writing style. If you are already familiar with basic programming concepts, but are new to Python, Beazley is your man.

In my most recent book, Rapture For The Geeks: When AI Outsmarts IQ, I argue that Python should be declared the Official Language of The Singularity. If you agree, cast your vote by leaving a comment below.

Rapture For The Geeks

Rapture For The Geeks also includes an Emily Dickinson poem translated into the Python programming language by Python experts Alex Martelli and Anna Ravenscroft (see page 196 of Rapture).

Have fun!

Richard Dooling

  1. Some visitors install newer versions of Python from the ActiveState downloads page. That’s fine. You can install more than one version and use different versions as you please. However, starting with Python 3.0, many commands are new and different. For example, the print command for Python 3.0 and following goes like this: >>>print (“Hello World!”). For this How-To, I recommend that you play it safe and install the version recommended by ActiveState. Most of the tutorials for newbies are still written for older versions of Python. But, hey, it’s a living breathing language, so if you like it, install and learn the newest version!

{ 150 comments… read them below or add one }

Ahan January 8, 2012 at 3:26 am

I at first installed python 3.2.2 and when I tried to print ” Hello World ” , it was not working, then I looked in this tutorial and found that the commands for ActivePython and python 3.2.2 is not the same. Then I installed ActivePython and the print hello world program works well now.
Thanks Sir.

I’ve a advice for my friends . If u want to learn Python easily without buying a book you can go to the following link :
http://www.learnpython.org

Reply

sheebs December 25, 2011 at 2:33 pm

That was really quick and made so easy!!! thanks ! thanks a lot!

Reply

Nima December 10, 2011 at 4:39 am

Hay man,
Thanks for this useful guide.
Just wanted to say that the download page now looks a bit different – at least to me! So you might want to change your article a bit so that the newbies are not confused.

Have fun

Reply

anna November 23, 2011 at 7:24 am

that is completely great : ) i really had to laugh at the point where you say i should watch the holy grail movie : P

Reply

vidz November 20, 2011 at 10:30 am

very useful stuff. keep it up.

Reply

noname October 3, 2011 at 9:41 pm

Hi

Hello World works on Python Shell.
How to run it in Explorer?

TQ

Reply

Me September 30, 2011 at 1:08 am

Win 7 64 bit – works perfectly.
start – programs – activestate activepython

away you go after that.

The instructions still work.

Thanks

Reply

Swet September 9, 2011 at 8:48 am

Thanks a lot…..I’m loving it… :-)

Reply

Al Vanderhoeven June 30, 2011 at 1:58 am

thanks for the fun and instructive read. I especially liked the monty python pun and link – it took more time to watch that than run the first program!

Reply

neurieser June 21, 2011 at 3:22 am

hello out there,

as absolute beginner to python i wanted to give it a try:

i’m using windows 7 enterprise 64-bit and installed ActivePython-2.7.1.4-win64-x64.msi as well as ActivePython-2.7.1.4-win32-x86.msi

trying to access start -> all programms -> ActiveState ActivePython 2.7 (64-bit) -> IDLE (Python GUI) or start -> all programms -> ActiveState ActivePython 2.7 (32-bit) -> IDLE (Python GUI) causes a flush (open and immediate close) of command window and nothing more.

little bit confused about that.

Reply

new to python June 4, 2011 at 9:01 am

Running windows xp sp3, MS Security Essentials, and Windows Firewall. I installed ActivePython-2.7.1.4-win32-x86.

When I run the IDLE I get a message that says:
Socket Error: No connection could be made because the target machine actively refused it.

Does anyone know what I could do to resolve this issue?

Reply

Kin Cheung April 23, 2011 at 12:03 am

Dear Sir,
(My website is not working yet. I have been just using it for web programming practice.)
Your instruction to install Python works well. I got the IDE interactive scheme set up. I would like to run a Python script in script mode. I don’t know how to do it. I have Windows XP. I put my script test.py in C:\Python27\script\. My script is
#!”/C:\Python27\python2.7.exe”
print “Hello World!”
Then, I tried to run it by typing test.py on the IDE window.It did not work. Please help. Thank you in advance. KYC

Reply

jamie April 3, 2011 at 6:42 pm

worked just fine on windows vista sp 2 64 bit. ty, ty, ty!

Reply

ashish singh March 18, 2011 at 3:19 pm

nice reading this especially for a biggener thanks!!!!!

Reply

Zhang zhilin March 15, 2011 at 10:06 pm

Thanks a lot for your excellent work!
This page help me a lot in learning Python. Thx

Reply

Rick February 20, 2011 at 2:23 pm

Getting out of the shell and the stupid <<< by reconfiguring IDLE suddenly made sense of the whole programming thing. Thx.

RH

Reply

Brian February 1, 2011 at 12:00 pm

Installed Python 2.5.5.1 on win xp . Hello world worked How do i get for loops and if decisions to work.

Reply

Richard Dooling February 1, 2011 at 3:09 pm

Brian,

What do you mean, get them to “work”?

You mean like this?

>>> name = “Richard Dooling”
>>> if name:
… print name
… (press return twice)
Richard Dooling
>>> for letters in name:
… print letters,
… (press return twice)
R i c h a r d D o o l i n g
>>>

After a conditional or a for loop, you have to press return and then indent four spaces. Is that what’s causing you problems?

Good luck.

RD

Try this tutorial if the others didn’t do it for you:

http://www.swaroopch.com/notes/Python_en:Table_of_Contents

Reply

Brian February 1, 2011 at 8:56 pm

Thank the extra return did it. I havwe python 2.5 working on windows 7.0 as far as loops and hello world i will keep you up to date aggain thank you

Reply

newiuce January 8, 2011 at 4:32 am

Great guide for beginners! Thanks so mush~

Reply

recentea November 6, 2010 at 10:04 am

very gooooood guide for python beginners, let me know how to start with python and provide lot of excellent resource for deep learning.
writting instruction should be like this, step by step and funny
thank you

Reply

Jos H November 1, 2010 at 4:56 pm

Exactly 4 minutes and 57 seconds after reading the link to the download page before Hello world in blue popped up on my screen. What a pleasure such a smooth written and didactically correct manual.

Reply

dreaming October 26, 2010 at 4:19 am

oh,you need update document print => print(“Hello World”)

Reply

Jasper September 29, 2010 at 5:05 pm

Thanks! works smoothly with ActivePython 3.1.2.3 (on XP)

Only difference, new print statement:
print(‘hello world’);
:-)

Reply

Neil September 20, 2010 at 2:00 pm

Not doing so well here. Loaded 2.6 but no Pythonwin Editor. Now loaded 3.1 and that does have win ed.
Error message shown:
PythonWin 3.1.2 (r312:79147, Mar 22 2010, 12:20:29) [MSC v.1500 32 bit (Intel)] on win32.
Portions Copyright 1994-2008 Mark Hammond – see ‘Help/About PythonWin’ for further copyright information.
>>> print “hello world”
Traceback ( File “”, line 1
print “hello world”
^
SyntaxError: invalid syntax
>>>
The machine is running XP Pro. Any pointers would be very much appreciated.

Reply

Richard Dooling October 28, 2010 at 3:42 pm

Neil, Sorry so long in answering, see above: You must have installed Python 3.0 or later. The print command for Python 3.0 and up is print (“Hello World!”).

Sorry for confusion.

RD

Reply

sharan April 4, 2010 at 11:18 pm

This website is good for learning python programmes

Reply

Pulp April 2, 2010 at 5:30 pm

YAY it’s working!you rule man! ;D

Reply

Brian March 23, 2010 at 11:38 am

Hey all, I downloaded phython on 7 got hello world to work.. No problem..!

Reply

Bob January 13, 2010 at 7:13 am

Thanks for the very helpful info. you saved my day.

Reply

gabriel December 30, 2009 at 6:21 pm

gracias, busque por dias algo asi de rapido, y sin complicaciones,

Reply

R November 7, 2009 at 11:17 pm

I’m having the same problem as M.

Reply

Richard Dooling December 11, 2009 at 12:26 pm

What version of windows? Apologies for long delay. Traveling. RD

Reply

M October 22, 2009 at 7:30 am

Hi. i seem to be having trouble. whenever i try to run python it says run but then it says “This installation package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer package.”

Pls help

Reply

Richard Dooling December 11, 2009 at 12:25 pm

Sorry. I have been traveling. What version of Windows?

Reply

C January 30, 2010 at 8:01 pm

windows xp

Reply

manik October 22, 2009 at 6:16 am

i have installed python but unable to run as it always throws error message i.e. raceback (most recent call last):
File “”, line 1, in
(-c)
NameError: name ‘c’ is not define
i tried working in pylot 1.26 and i have also installed python 2.5 + and other softwares given on site

Reply

Karthik October 3, 2009 at 1:44 pm

I am in Vista Enterprise and faced absolutely no problems.

Reply

greddy September 23, 2009 at 1:52 am

Thankz alot sir…..

Reply

Richard Dooling August 10, 2009 at 7:38 am

Dear Stephen:

Google says:

http://tinyurl.com/5u43y3

First hit. Let us know if it works.

Thanks.

Rick

Reply

Stephen Dzuro August 6, 2009 at 7:07 am

Richard,
You wrote: “Any Vista users? You can help by leaving a note about any differences you encounter while following these instructions on Vista.”
I’m using Vista Home Premium SP1.
I tried you approach to instillation (activePython-2.6.2.2 win32-x86) along with others (python 262 [compiled HTML Help file] and python-2.6.2.2 win32-x86 [windows installer package]) and continue to get the following error message.

Windows Installer
The Windows Installer Service could not be accessed.
This can occur if the Windows Installer is not correctly
installed. Contact your support personnel for assistance.

Any thoughts on how to fix this issue?

Reply

wannabe super nerd August 5, 2009 at 11:42 am

thanx a bunch for the guide
there’s one other dialog box for vista users to plow through, as always. If you miss this box for whatever reason, you have to re-install the program.

and your book is awesome

Reply

vongurdy July 30, 2009 at 4:06 pm

Excellent Job! Thank you for the guide through

Reply

a wannabe pyhton ninja July 5, 2009 at 2:18 pm

thanx an infinity……..!!

Reply

jerjer July 2, 2009 at 3:35 am

It took me 8 minutes actually because I had to watch this while installing. http://bit.ly/19tYVd

Reply

Kanth June 29, 2009 at 10:12 pm

Thank you so much, very easy to follow and step by step instructions….too good.

Reply

anil June 21, 2009 at 5:00 pm

hello world!
thanks

Reply

Vivek May 19, 2009 at 9:00 am

Python?????

Reply

Viper October 28, 2010 at 8:30 am

its too bad…….

Reply

riki May 12, 2009 at 1:30 pm

thank you sooooooooooooooooooooooooooooo much Richard

Reply

Leave a Comment

{ 2 trackbacks }