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]

{ 123 comments… read them below or add one }

Death Poet May 6, 2009 at 6:50 am

thanx man thats awesome … i would never have done it that fast

Reply

Copper May 2, 2009 at 9:38 pm

Nice, Thanks for the intro

Reply

Adeel Azmat April 26, 2009 at 3:58 pm

Nice and updated installation guide, thanks :)

Reply

Richard April 3, 2009 at 2:33 pm

Thanks!! This worked great – and was fun to read. I was on Vista and except for one additional message, it was perfect. Note: That additional message was when I double clicked on the msi, I had to acknowledge something to the effect that the publisher of this software was unknown.

Thanks again,
R

Reply

Sindhu March 30, 2009 at 5:42 am

Richard,

This is very motivating. Thanks for making it look so simple

Reply

Woods February 25, 2009 at 5:02 am

Good tutorial!

Reply

Flesh January 27, 2009 at 6:19 am

Also, version 2.6 of python is out. (The version I downloaded).

And further more, you are awesome. You should try get a holiday named after you.

Reply

Flesh January 27, 2009 at 6:06 am

wow. That was a fair amount of links in one small paragraph. You wouldn’t happen to edit wikipedia, would you?

The only reason I have Microsoft Word on my computer is because my mum wanted to look at some files that were for specifically Microsoft Word. (I’m 16, if you were wondering about me living with my mum). Otherwise I would have never bothered with it. (I use it at school, I don’t really like it much. It’s a pity that they don’t offer anything else).

Thanks for the info, I will take it under consideration.

Reply

Richard Dooling January 26, 2009 at 7:43 am

Dear Flesh:

Some might say that you can use Microsoft Word as a text editor, but you are better off using Notepad or WordPad. I haven’t used Windows for years (I’m on Linux and Mac OS X). There are literally hundreds of excellent free text editors to choose from, no matter what your operating system. I prefer Vim myself, but it takes a bit of learning to operate, like any powerful tool. Learn more about text editors at Wikipedia.

Reply

Flesh January 22, 2009 at 7:11 pm

Hello, world! :D

I just downloaded Python! It took me about 6 hours to download. (I live out in the middle of nowhere and the phone lines can’t handle broadband out here, so I’m stuck on slow dial up).

To the guy above who is using Mozilla, did you left click or right click? I had a problem like that when I tried to download something ages ago. It’s best just to left click on it.

Is Microsoft Word a good text editor to write python code in? (I also have Notepad and Wordpad if either of those are better to use)

Oh yeah, and thanks for all the help!

~Flesh

Reply

The guy who called himself a question January 17, 2009 at 10:03 am

I now think I know why python didn’t install. :( I used Mozilla and the installation box didn’t appear. Instead Mozilla download box appeared. :( :(

Reply

The guy who called himself a question January 17, 2009 at 9:58 am

It didn’t install… Probably because I was installing two things at once. :(

Reply

Why do you want to know? January 17, 2009 at 9:35 am

Whoops, didn’t say thank you. Thank you, Richard Dooling!

Reply

Why do you want to know? January 17, 2009 at 9:34 am

Didn’t time it. I used this one because the newest one was too hard :( . Hooray for older versions of stuff! :)

Reply

Richard Dooling January 10, 2009 at 5:14 am

Audra,

I think you are possibly confusing two or maybe three things: (1) running a file that contains Python code; (2) editing such a file; and (3) interacting with the Python interpreter. When you say that you have “downloaded certain files that require python editor,” what does this mean? If these files are Python scripts or modules, then you would run them using Python, but you would edit them with any text editor.

I think you should continue with the tutorials I linked to until you grok the differences, then set up your particular environment to run the files you downloaded. Pay particular attention to editing, saving, and running your OWN simple beginning script using one of the tutorials, and then it will become clear how to run some other Python program that you downloaded.

I can’t really provide support here, but once you have a little bit more knowledge you can post to:

http://groups.google.com/group/comp.lang.python

And someone will help you.

Thanks,

RD

Reply

Audra January 9, 2009 at 7:52 pm

Thank you so much for making python understandable. I had downloaded it (the zip version) but after unzipping, was at a standstill. Now, that you have successfully talked me through opening up Python Interpreter, how the heck do I use it? I happen to have some certain downloaded files which require python editor–so now how do I get the files to the interpreter? If I just click on them, I get a message they require python interpreter–duh! Help–for the semi (or mostly) computer illiterate.

Reply

DAmanda January 4, 2009 at 10:52 pm

This is perfect for people like me who don’t actually want to use Python but need it installed to run Blender’s python scripts. Just an FYI for anyone else installing Python for Blender…you must use the older version of Python that Blender recommends, Blender won’t recognize newer versions of Python. Happy sculpting!

Reply

Paresh Nawar January 1, 2009 at 7:22 am

I am new to the Python and i think the information given by you will help me to learn more about Python.

thanks!!!

Reply

Sammysnake December 29, 2008 at 3:31 pm

Thank you Richard I’ll go and poke around over there.

Sammy

Reply

Richard Dooling December 29, 2008 at 2:27 pm

Sammysnake:

A perfect question for the Python Google Group:

http://groups.google.com/group/comp.lang.python

Usual answer is neither. Leave the present Python installation in place. If you want or need a new version, just install it separately. You can summon either version as needed. Your system may use or require the old one just to function, so don’t tamper with it.

RD

Reply

Sammysnake December 29, 2008 at 11:53 am

I have a HP computer that came with python installed on it and it is a very old version. I’m just now looking into messing around with python and was wondering if I need to uninstall what is on my system or just install over the top of it the newer version. Any suggestions?

Reply

Rajib Pandey November 25, 2008 at 10:57 pm

i WOULD LIKE TO BUY dvd BUT THE LINK DO NOT WORK

Reply

Richard Dooling November 24, 2008 at 3:54 am

Kyle,

Your question is a perfect one for the comp.lang.python google group. You’ll get a wide variety of opinions and responses, and they may also ask for more specifics from you about what kind of programs, etc. But that would be my first choice for a broad question like yours:

http://groups.google.com/group/comp.lang.python/topics

Good luck,

Reply

Kyle November 23, 2008 at 4:23 am

Awesome site Richard!

I have been running searches all over the net looking for python tutorials that focus more on scripting programs. Most of what i found sticks to the “print” and variable tutorial basis. Do you know of a site that a person can start learning creating actual programs?

Kind Regards,

Kyle

Reply

Daniel November 18, 2008 at 3:13 pm

This worked great for me (WXP+SP2) and can use LastFMProxy not just in Linux :-)
http://www.last.fm/group/LastFMProxy
Thanks…..

Reply

Murray November 17, 2008 at 9:06 am

Thanks for your site. The download process was both educational and functional. Much appreciated.

Reply

Cathy November 13, 2008 at 6:46 am

I have installed Python 2.3.5 on my windows XP computer and when I open IDLE (Python GUI) nothing happens. What should I do

Reply

Parikshit Kunjalwar November 13, 2008 at 3:19 am

Hi ! its a great tutorial on python .. could you please let me know what is the basic advantage of using python over java. is it fast or more convinient to code .. we have some daily jobs which are written in pyhton but the thing is we have lot of people having java skills and no one with python . so is there anything special in python for which we should ask java developer to learn and code in python

Reply

Steve November 6, 2008 at 6:52 pm

Thank you for this. You have saved me a lot of trouble.

Well, here I go…

Reply

Oskar October 28, 2008 at 5:23 am

This helped me a lot. Thank you.

Reply

Randy October 5, 2008 at 9:41 am

I hypothesized the following:

Download procedures are very simple when described with patience, care and concern for their users.

I believe you’ve proved it.

Thanks – Randy

Reply

MATT BROWN September 25, 2008 at 11:04 pm

Just wanted to say thank u for your help in my quest to be free.

Reply

chesvoc September 23, 2008 at 6:10 pm

Thanks.Reading your tutorial I setup pyton successfully.I was looking for tutorials explaining how setup this program,and I didn’t find anyone easy.I though I never succed,but I did.Now I’m following the tutorial recomended by you,alan gauld’s.

Reply

orot September 22, 2008 at 6:34 am

i like this site…thank you…

Reply

Richard Dooling September 4, 2008 at 11:40 pm

Jack,

I use Linux and Mac OS X, but I’ll check on a Windows machine tomorrow. You can use the interpreter inside PythonWin just fine. Or open a command prompt, like C:\> and type “python” and press return. That too should give you a Python interpreter.

As I say, I’ll check myself tomorrow on a Windows machine.

RD

Reply

Jack September 4, 2008 at 9:34 pm

Hi Rich,just ran the pythonwin program and it seems i can’t find the related python idle program on my pc, it only shows pythonwin, python interactive shell,python documentation and and python reinstallation(modify,etc) on my startup.Is there a way to fix this or did i download the wrong version?

Reply

Linda August 30, 2008 at 10:14 am

Thanks a million for this easy step-by-step guide. The options on the main download page were daunting for this novice.

Reply

Squall August 23, 2008 at 4:46 am

Thank you very much :D :D .

Reply

Randy Brinson August 19, 2008 at 3:33 pm

There is lots of good information out there. However, it is very rare to find something as readable, accurate, and time-efficient as this guide. Sure wish I had found this site the first time I went paddling in the python pool.

Looking for a tagline for your site? How about, “Learning should be a joy, not a task.”

Reply

Derrek Thompson July 28, 2008 at 11:48 pm

This actually works. Thanks!

Reply

Randall July 24, 2008 at 6:06 pm

Awesome help here, THANKS MATEY.

I’d write you a letter and post it but I think that would be a bit weird. but I like sending letters.

Thanks for writing this though. GOOD JOB, SIR.

Reply

John Caddy July 18, 2008 at 8:37 pm

Awesome! I am teaching my 11 year old son to program and your 7 minutes to Hello World made getting python up and running super simple. He just let me back on the PC after about 4 hours of raw_input’s and print commands… Thanks!

Reply

Megan July 16, 2008 at 8:14 pm

I’m having some problems once I’ve installed the ActivePython. I can access the shell quite fine, but opening the PythonWin Editor gives me this error message and doesn’t open anything up/can’t start a new file/can’t do anything:

File “C:\Python25\Lib\site-packages\pythonwin\pywin\framework\intpyapp.py”, line 171, in InitInstance
import interact
File “C:\Python25\Lib\site-packages\pythonwin\pywin\framework\interact.py”, line 8, in
import code
: (‘invalid syntax’, (‘code.py’, 9, 25, ‘if__name__ == “__main__”: web.run(urls, globals())\n’))

Any ideas?

Reply

Emanuel July 8, 2008 at 4:04 pm

hello I been learning python by a month now, am reading the book “python programming on win32″ by mark hammond, but this book is very old a some of the examples are easy to understand and others not so easy, most of the problem are in the parts of COM, using de excel, word and visual basic stuff, a have being writing the code of the book and it even donwload the examples, but we i run then, most of then nothing hapends even wen in the book saids the oposite , if some could help me, i have python 2.5 on windows xp, and i beginning to wonder if this is the problem

Reply

Tariq Momani June 10, 2008 at 4:59 am

Thanks for your help.
It’s agreat job

Reply

Vivek June 5, 2008 at 9:37 am

Thanks so much!!! I really wanted to start python… and just been really lazy. But this was really great !!! Thanks again

Reply

Windows XP April 28, 2008 at 8:28 pm

Why are you trying to get people to get Python from a different site than the original python site? Python kicks some butt, and has a lot of functions, and I would rather be safe using it from the creator’s site, because if NASA can trust it, so can I!

Besides “Hello World!” isn’t hard at all:
code: print “Hello World!”

Reply

Vivian March 27, 2008 at 7:54 pm

Thanks a lot

Reply

Megin March 4, 2008 at 9:01 pm

Thanks!!

Reply

Richard Dooling February 28, 2008 at 5:36 pm

Professor Gauld left a note on comp.lang.python (google group) saying he was having hosting problems and had copied everything to a temporary server.

Try this:

http://uk.geocities.com/alan.gauld@btinternet.com/

rd

Reply

Leave a Comment

{ 1 trackback }