Copyright Anne Dawson 2005 - 2011

This file is: http://www.annedawson.net/Python3_Install_Run.htm
First created: Sunday 10th May 2009, 8:33 PT, AD
Last updated: Saturday 23rd April 2011, 15:33 PT, AD

How to install Python 3 and run Python programs using the IDLE editor

by Anne Dawson PhD

Skip to IDLE Instructions (assumes Python 3 installed)
Which version of Python should you install?
Example Python 3 Programs
Example Python 2.x Programs
Python Programming Hint Sheet
Python Useful Links

More Python Resources

Important note:


At the time of writing this document the current version of the
Python interpreter software is version 3. Please note that Python 3
is ***NOT*** compatible with earlier versions of Python. 

Be aware that there are some significant differences between Python 3
and earlier versions. For beginner Python programmers, the main ones
are that the print statement of Python 2.x is now a print function in Python 3,
the raw_input function in Python 2.x is replaced by the input function in Python 3,
and an integer division such as 2/3 in Python 2.x is now a real division
in Python 3. 

For experienced programmers, also check out 
the range() and string formatting differences outlined here:
http://inventwithpython.com/appendixa.html


A full list of differences between Python 2.x and Python 3 can be found here:
http://docs.python.org/3.0/whatsnew/3.0.html.
Newer versions of Python 3 will be released in the future.
Newer versions of Python 3 will (hopefully) be backward compatible - 
which means that if you write Python programs using version 3,
they should still run using future versions of the Python 3
interpreter. You should always download the latest version of the
software as it will contain the latest features and bug fixes.


1. Go to the Python web site


http://www.python.org

You will see this screen:

Python 3 installation screen 001



2. Download the Python software





The instructions on this page were written for Python version 3.0.1 
and should work for all versions 3.x. An instruction manual for Python 2.x is available here, 
but the Python organization recommends the use of the latest version of Python 
- at the time of writing this document, the latest version of Python is 3.0.1. 






Click on the DOWNLOAD link on the left hand side of Python's home page. 

You should then see the following screen:


Python 3 installation screen 002




To download and install Python 3 for Windows (XP, Vista etc), click on the link for
Python 3.0.1 (February 13 2009) shown in the screen above, two thirds down the page. 



Python 3 installation screen 003



Click on Windows x86 MSI Installer (3.0.1) (Sig) to see this extra window:


Python 3 installation screen 004


Then click on Save File to save the python-3.0.1.msi file to disk...

Once the download is complete, locate the python-3.0.1.msi file on your computer,
and double click on it to start the installation of Python 3.0.1. 

If you're using Firefox and Windows XP, the following file is saved
to your desktop. Any other operating system or browser will save the
file to your specified folder. Locate the file (python-3.0.1.msi) on your desktop
and double click to start installing Python.

You will then see this screen:

Python 3 installation screen 005


Just click on "OK" to start the installation.


You will then see this screen:

Python 3 installation screen 006

Click on the "Run" button...


You will then see this screen:

Python 3 installation screen 007




If you have multiple users on your computer, just click on the Next
button, otherwise click on the Install just for me, then click on
the Next button.  

You then see the following screen...

Python 3 installation screen 008


Just click on the Next button to install Python into the C:\Python30\ folder.

You will then see this screen:


Python 3 installation screen 009



Just click on the Next button to install all available features.

After a short time, you will see this screen:


Python 3 installation screen 010


then this screen:


Python 3 installation screen 011


then this screen:


Python 3 installation screen 012




Click on the Finish button to complete the installation.  

After the installation is completed, 
you can then start up Python's editor (IDLE)
to create and run Python programs, see below...


Watch the IDLE Editor movie below (11 minutes)...

Python Editor IDLE movie








Follow these instructions to write and run a simple Python 3 program using the IDLE editor:



Python 3 installation screen 013




1.  Start IDLE (see screen above). You will then see a window entitled "Python Shell" ...


Python 3 installation screen 014




2.  From the Python Shell window, select New Window from the File menu.

3.  You will see a window entitled "Untitled"



Python 3 installation screen 015



4.  From the File menu, select Save As, 
     and select a folder to save your Python program file.

Python installation screen 026



5.  Select a folder to save your file in.

6.  In the File name: text box, type: program1.py

7.  Then click on the Save button. 
     You will then see a blank editor window ready 
     for you to type in your Python program.




Python installation screen 028



Notice the full name of your program file and its full path shown in the title bar of the editor window.



8.  Type in the following text into this window 
     (make sure the word print is all in lower case):

    
     print ("Hello World")

Python 3 installation screen 016


Note: if you have saved your file with a name ending in .py
then you will see the text in color in the IDLE editor window. The word "print" is in purple font,
and the text "Hello World" is shown in green font. This assumes you haven't changed the default editor colors.

An aside for Python 2.x programmers: in Python 3, the keyword print is now a function, hence
IDLE will display the word print in purple font (the color for functions), whereas in Python version 2.x,
the word print is shown in orange font (the color for Python keywords). 



9.  To run this program, select Run Module from the Run menu.


     You should see a reminder to save the Source (your program). 
     Click on OK to save.

     Then you will see your program running in a Python Shell window.


Python 3 installation screen 017


Notice all output to the shell window is in blue font.


10.  Close all Python windows to quit Python.






IMPORTANT: 



To open your Python file again, 
locate the file in the folder, 
click once on the file name it to highlight it, 
then right-click on the mouse to see the options shown in
the screen below, and select Edit with IDLE 
to open the editor window. 


Python installation screen 030



From the editor window (the window with the program's name in the title bar),
select Run Module from the Run menu to 
see the program run in the Python Shell window.



****************************************************************
    To close a Python Shell or IDLE editor window
     Select Close from the File menu. 
****************************************************************
    To open and run an existing program file
     Select Open from the File menu.
****************************************************************
    Getting Help on IDLE
     Select IDLE Help from the Help menu
****************************************************************
    Getting Help on Python
     Normally you select Python Docs from the Help menu or press keyboard key F1,
     but the path is not correct - IDLE currently searches for documents here:
     http://docs.python.org/dev/3.0/ 
     when the Python 3 documentation is actually located here: http://docs.python.org/3.0/

Documentation for all versions of Python can be found here: http://docs.python.org For experienced programmers, also check out IDLE's debugging tools at: http://inventwithpython.com/chapter7.html
**************************************************************** To exit the Python Shell or IDLE editor Select Exit from the File menu. **************************************************************** Example Python 2.x Programs (HTML format) Example Python 2.x Programs (text format) Example Python 3.0 Programs (text format) Search for more computer science topics on www.annedawson.net

www.annedawson.net

Valid XHTML 1.0!

Valid CSS!