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

by Richard Dooling on March 14, 2006

in Geekophilia, Python

“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.

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 XP, with all of the “hooks” you’ll eventually want to control your Windows machine and Windows programs using Python.

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!

  • Open another browser window (so you can keep reading this one) by pressing shift-and-click on the: ActivePython page of the ActiveState site.
  • ActiveState can tell what type of computer you are using, so you should be seeing an icon that looks like this:

ActivePython

  • Click on it! And 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-2.6.3.7-win32-x86.msi.” It’s about 31 megabytes, which is half the size of the last driver I installed for my Logitech Mouse.
  • Double-click on the ActivePython file. (One user reports that on Vista you must 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 2.6.
  • The menu will break out into submenus. You want the one that says: “Pythonwin Editor.” 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!

Python Win IDE

You are inside the interpreter of the Pythonwin 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!

Any Vista or Windows 7 users? You can help by leaving a note about any differences you encounter while following these instructions on Vista or Windows 7. So far it seems you must acknowledge that the publisher of the software is unknown? 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 one of these two written for beginners:

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, 3rd 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, 3rd 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

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

{ 1 trackback }

Richard Dooling » Blog Archive » Why Python on Windows XP?
January 1, 2009 at 1:10 am

{ 120 comments… read them below or add one }

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

riki May 12, 2009 at 1:30 pm

thank you sooooooooooooooooooooooooooooo much Richard

Reply

Leave a Comment