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 }

Megin February 28, 2008 at 5:30 pm

This really helped. I was also referring to Professor Gauld’s website about a month ago and it was great, but now I can’t access the website anymore. Is is just my computer or has the website gone??

Reply

Olivia February 23, 2008 at 6:33 am

Thanks a lot. It really helped!

Reply

Richard Dooling February 22, 2008 at 9:13 pm

Olivia,

Sure ActiveState has the 2.5 version. I think you’ll like the GUI better.

But now that I’m here, I see that ActiveState changed their menus and such, so I better go reconfigure!

RD

Reply

Olivia February 22, 2008 at 8:59 pm

This really helped a lot. The problem is that I’ve installed the recent version of Python on the python.org distro and I’ve been having problems with the interpreter. I would uninstall 2.5, but I know that they’ve made changes and added some new features. So I was wondering if Active State has version 2.5 that I could install. I’m also not quite sure if it’s “worth” uninstalling. Does it really matter what version I use?

Reply

Richard Dooling February 5, 2008 at 5:11 am

Dear Petunia,

I couldn’t figure out how to use the Windows command prompt either. That’s why I made the page! Glad it helped you.

Microsoft hides the command prompt, because if their customers learn to use a shell, and learn languages like Python, then they’ll move to Linux.

Use Python and a good cross-platform text editor on Windows until you’re thoroughly comfortable. Then take an old computer and load Linux on it. I recommend either Ubuntu or Debian, but there are many other distributions.

Enjoy.

RD

Reply

Virginia Morris February 5, 2008 at 2:53 am

Thanks so much from a sort of Omega Geek (yeah, that far from Alpha!). I tried downloading from the python site, read tons of instructions for using Python from LINUX-like and UNIX-like operating systems but couldn’t figure out how to use the Windows command prompt or path settings to get anything out of it at all. The ActiveState download, coupled with your instructions, is just great!!

Hope to get far enough to be able to check out some of your “advanced” links!

- Petunia

Reply

Richard Dooling February 1, 2008 at 6:54 am

Several questions here from programmers who are refugees from other programming languages. For you, the official Python Tutorial is probably your best bet:

http://docs.python.org/tut/tut.html

Also, consult the documentation section at http://python.org

Good luck,

RD

Reply

TB January 12, 2008 at 10:54 am

I have found the solution. The python version ‘AMD64′ is made for 64-bit-systems. I have heard that some functions in this versions don’t work.
Every windows processor should be able to work with the python version for x86 processors (also just called ‘windows’).

Thank you anyway.

Reply

TB January 11, 2008 at 2:32 pm

Why there is a special download for AMD64 Processors on http://www.python.org available? Do I need this download if I have a “AMD Athlon ™ 64 X2 Dual Core Processor” ?

Reply

Ellie January 10, 2008 at 3:47 pm

Thanks for being genrous enough explain all this, I tried to install Python myself and got into a terrible mess!

Reply

chas January 8, 2008 at 2:36 am

hello i am new with python. i had just read it on how to become a hacker. i am interested to know about it. i have learned my first language c++ then java. now i try for python.

i am downloading now then look for tutorial here. can you guide me?

Reply

not January 3, 2008 at 4:43 pm

are there any tutorial for users who are profecient programmers but just not in python?

Reply

Richard Dooling December 20, 2007 at 10:40 pm

Geoffrey,

I don’t know Zope. I just recently purchased the Django book, though, which looks very good. Also see http://www.djangoproject.com.

As for the Chun Core Python book, I don’t know it. I’ve heard good things about it. Of the ones I’ve seen lately, I guess I would go with 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 for programmers coming from another language. Newbs may find it overly terse and should try some of the other recommended books. If you are already familiar with basic programming, Beazley is your man.

Reply

Geoffrey Darnton December 20, 2007 at 6:35 pm

Very nice installation – complements to the chef!

After Python, I’ll try to modify the Zope cookery book to what I want! – do you have any suggestions for an idiot’s start to Zope?)

Chun’s Core Python Programming seems to review well on Amazon – any experience or knowledge of it?

Reply

Asad December 9, 2007 at 7:27 pm

First step into the programming world. Lets see how this goes.

Reply

Fodderz November 4, 2007 at 6:41 am

downloaded and used python for the first time yesterday and couldent have done it without you!!! it is great fun and shockingly easy once you know how thanks

fodderz

Reply

Jennifer Morgan October 9, 2007 at 4:15 pm

This was the best installation instruction I’ve ever come across. Thanks a lot!!!! :-)

Reply

Richard Dooling August 18, 2007 at 9:38 am

AM,

Are you running on an encrypted drive?

See http://tinyurl.com/2eysjm

rd

Reply

am August 18, 2007 at 8:30 am

I have windows XP…trying to download Python getting error 2755.

Thankyou

Reply

NodozFi2eak August 17, 2007 at 3:08 am

wow took longer to read the tutorial than to install.. PYTHON HERE I COME!!! =D

Reply

SRS August 16, 2007 at 4:22 pm

Hi,

Just wanted to say that I’m starting out with this language. I’ve no prior experience save some dabble here and there in HTML, which I doubt will help me very much, but I’m willing to learn. Thank you for this, because I will follow the tutorial word for word, until I can get on my feet :}

-SRS

Reply

Richard Dooling August 2, 2007 at 6:34 am

Dear Ariel:

ActivePython has very good customer service, so ask them there.

Do you by any chance have your disk partitioned into logical drives, like C,D,E etc.? If so, and you downloaded to one of those logical drives, then try copying the installation file to C:\ – the root of your C
drive and double click on it there.

Hope this helps.

rd

Reply

ariel August 1, 2007 at 6:07 pm

sir rick,
i just cant open the installer. i have an error that says ” installation package could not be opened. contact the application vendor to verify that this is a valid windows installer package. is there something wrong with my os?

Reply

Richard Dooling June 28, 2007 at 8:13 am

Chris,

Thanks for pointing that out. It must be new terminology in the latest Activestate distro. Yes, they are the same.

Send any other edits or suggestions as you go. I appreciate it.

rd

Reply

Chris June 26, 2007 at 7:04 pm

Not sure if this is a dumb question, but…

The instruction above says to click on the “Pythonwin IDE” submenu. Instead, I see a submenu entitled “PythonWin Editor.” Are they one in the same?

Reply

Skannd June 14, 2007 at 1:42 pm

Nicely done! the parseltongue hyperlink especially ;-p a very helpful tutorial dude… thanks a ton!

Reply

madhur June 8, 2007 at 1:56 am

very good!
dude it was awesome tutorial.
thanks.
i want to contact you

Reply

Richard Dooling May 27, 2007 at 2:28 pm

Rami,

This is a perfect question for the comp.lang.python group. Very
active. I’m sure you would have many responses quickly. However I
predict you will not get too much sympathy for saying “I don’t want to
waste time” as most programmers will tell you to try them both.

That said. I think your question comes up a lot. If you go to
comp.lang.python and search on python and php you’ll see what I mean

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

Good luck

Reply

Rami May 26, 2007 at 3:13 am

i loved this tutorial, great stuff, i have a question if you can answer it i’d be glad just send me an e-mail with the answer “i have some experience in PHP and MySQL, and i am in the process of creating my own Content Management System, but after reading about Python and seeing professional programmers recommend Python i loved to give it a try, i would like to know if Python is the right choice for a begginer like me or shall i complete with PHP? because i don’t want to waste my time, thank you”

Reply

JiminyCrockett May 7, 2007 at 1:25 am

That was excellent Richard. Thanks very much for making it so simple to follow and easily get through it.

I’m sure a lot of questions will arise, but for now I’m good..

JC

Reply

Richard Dooling April 21, 2007 at 9:51 pm

Grant,

I think you can get almost the full effect by just installing Mark Hammond’s Win32 extensions together with your recent Python installation.

Here is the site.

http://starship.python.net/crew/mhammond/win32/

The ActivePython distro just installs BOTH Python and the win32 extensions together in a nice package, but I don’t think it’s worth uninstalling your other installation unless you are having trouble. I believe the ActiveState Python distro also sets up your environment, paths, etc. But you can also do this yourself.

I use both ActiveState on one machine and the Python.org distro on others. But then I’ve moved to Linux so I can’t say for sure about the Windows thing.

Try just installing the win32 extensions. The gui IDE is very nice compared to the dullish IDLE one.

Good luck

rd

Reply

Grant R April 21, 2007 at 6:14 pm

RD
I did not find your info until I had downloaded Python 2.5.1 from http://www.python.org/ which had IDLE (Python GUI) with it.
I would like to try the ActiveState PythonWin IDE.

1. Do I have to Uninstall Python and download it again from ActiveState to get the IDE program?

2. If I download ActiveState’s Python, am I going to get the latest version, 2.5.1?

3. Can I get the ActiveState PythonWin IDE easily and try it? How?

Thanks for your help.

Grant R.

Reply

Richard Dooling November 20, 2006 at 5:07 pm

Matt,

You don’t need the ActiveState distro, too. You just need the
extensions.

The ActiveState version is stuck at 2.43 for the moment. If you’ve got 2.5 it’s the most current. If you’d like the Windows Extensions, you can download them here:

http://sourceforge.net/projects/pywin32/

Some people prefer the PythonWin IDE to IDLE (which comes with the standard install).

You can try both.

But don’t install the old ActiveState distro on top of 2.5.

Sorry for the confusion.

rd

Reply

matt November 19, 2006 at 5:31 pm

I’m new to python and just loaded up the 2.5 version from python.org. I didn’t even see something else to download (the win32 stuff you’re talking about). Do I really need it? What is it for?
I know those are probably the types of question that are to user specific or to broad to answer in a few sentences, but if you can I’d like to know. I guess I’ll just go get the ActivePython verson also.

Thanks,
Matt

Reply

Richard Dooling October 30, 2006 at 6:46 am

Dear Matt:

Sorry. Not familiar with Webmin. Looks a bit dodgy for Windows. Just scanning the instructions, it looks like you need ActiveState Perl installed, along with a module and such. Seems like primarily a Linux tool? Let us know if you get it working and if it’s worth the install.

As for Python, be advised that the ActiveState distribution will upgrade to Python 2.5 soon. It’s basically just an uninstall and reinstall using the 2.5 distro. You can download 2.5 from Python.org now, but then you must install the win32 stuff separately, blah blah. Not pain free, in other words.

Just stay with 2.4 for now, especially if you’re just getting your feet wet.

I’ll post the ActiveState 2.5 instructions as soon as they come out with it.

Thanks,

rd

Reply

Matt October 30, 2006 at 6:32 am

Pain free instructions, thank you very muchly. Do you know of a similar resource for how to install Webmin on Windows? Webmin’s own instructions assume too much knowledge and I’m no sysadmin.

Reply

Maxi October 25, 2006 at 8:15 am

I like so much your style,
thanks for the tutorial.
See ya!

Reply

Ix Ch0s3n Ix July 7, 2006 at 6:24 pm

This was my first step to hacking and programming, thank you!

Reply

RonCo May 30, 2006 at 8:21 pm

Great tutorial!!
Thanks!

Reply

Richard Dooling May 15, 2006 at 6:26 pm

Have heard great things about Eclipse (although I’m a Vim user myself). I have not tried Eclipse yet.

The Eclipse home page is at:

http://www.eclipse.org/

The PyDev home page is at:

http://pydev.sourceforge.net/index.html

Reply

yrth May 15, 2006 at 6:14 pm

Why not hint at eclipse with pydev as a python ide? eclipse is also cool to write java, php, cmfl, and to some extent even fortran or c. it’s free and i guess you can set it up in 7 minutes with pydev, assuming you have a fast connection to load pydev from the update site.

Reply

Richard Dooling April 24, 2006 at 10:07 am

>> pythonwin != IDLE . idle is the
>> funny little (python/tk programmed)
>> python “ide” that comes with the official download.

Fixed. Whatever it is it’s Eastern Bloc ugly compared to the Pythonwin IDE :)

Rick

Reply

THC4k April 24, 2006 at 10:02 am

Oh yeah, and for a book i suggest “Learning Python” by Mark Lutz, David Ascher . I learned to love python with this book, its very good ;)

Reply

THC4k April 24, 2006 at 9:58 am

pythonwin != IDLE . idle is the funny little (python/tk programmed) python “ide” that comes with the official download.

But you are right to use Activestates distribution, because the IDE is way better than idle and they include the win32 extension and the rest is the same.
If you want to seriously lern some python, check out http://www.diveintopython.org , the de-facto standart book on python on the web.

Reply

Richard Dooling April 23, 2006 at 11:56 pm

Scratt,

What am I using to get bullets? I’ll check the css tomorrow and see if I can find it. If you are are a WordPress user, you can poke through the Wuhan download. That’s what I made it from. I did a lot of work on the sidebar and header, but the post code should be just the way you find it in the Wuhan theme download. See if you can find what you need there.

http://wuhan.authenticasian.com/

Rick

Reply

scratt April 23, 2006 at 11:46 pm

Great. Thanks for that.

By the way.. What are you using in WordPress to get the bullet points in the post? I have been looking for something like that for a while.

Thanks.

Reply

Tim April 23, 2006 at 6:22 pm

Dude, that was awesome. And only took 3 minutes.

Reply

Dan Atkinson April 23, 2006 at 5:41 pm

I timed it at two minutes (and a bit) dead!

Excellent stuff!

Reply

Richard Dooling April 22, 2006 at 7:43 pm

Brendan,

Does the Python.org version include the Mark Hammond Win32 extensions? Don’t they have to be installed separately? I thought this came up once on the Python boards, and people told me they were two separate downloads.

The idea here is to get Python downloaded and installed for the user who is perhaps intimidated by a big shaggy page of versions, bug fixes, and multiple downloads.

Rick

Reply

Brendan April 22, 2006 at 7:12 pm

1. Why wouldn’t you just download the official Python windows installer http://www.python.org/download/ ? It seems a little bit pointless to use Activestate’s repackaged version when you could get the official version from the creators in a Windows-friendly format.

2. Another good reference for Python beginners is located at: http://www.ibiblio.org/obp/thinkCSpy/

Reply

Leave a Comment

{ 1 trackback }