ÿþ<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=unicode" /> <meta http-equiv="Content-Language" content="en-us" /> <style> <!-- p.MsoNormal, li.MsoNormal {margin-top:0mm; margin-right:0mm; margin-bottom:10.0pt; margin-left:0mm; line-height:115%; font-size:12.0pt; font-family:"Times New Roman","serif";} a:link {color:blue; text-decoration:underline;} a:visited {color:purple; text-decoration:underline;} p {margin-right:0mm; margin-left:0mm; font-size:12.0pt; font-family:"Times New Roman","serif";} ol {margin-bottom:0mm;} --> </style> <title>Open source python installed and test on Windows</title> <meta name="keywords" content="python, opensource, technology, applications, web, server, system, scripts, programs, examples, web hosting, programming" /> <meta name="description" content="A tutorial on how to install, configure and test Python on Windows" /> </head> <body lang="EN-US" link="#0000FF" vlink="#800080" topmargin="20" leftmargin="20" rightmargin="20" bottommargin="20"> <div class="WordSection1"> <p align="center" style="margin-bottom:0mm;margin-bottom:0; text-align:left; line-height:100%; margin-top:0">&nbsp;</p> <h1 align="center" style="margin-bottom:0mm;margin-bottom:0; text-align:center; line-height:100%; margin-top:0"><font face="Arial"> <span style="line-height:115%">Python for Windows (Windows XP Pro)</span></font></h1> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0">&nbsp;</p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0">&nbsp;</p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0">&nbsp;</p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0" align="center"><script type="text/javascript"><!-- google_ad_client = "pub-8089415323104206"; /* 728x90, created 5/16/08 javaos */ google_ad_slot = "1917524460"; google_ad_width = 728; google_ad_height = 90; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0">&nbsp;</p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0">&nbsp;</p> <p style="margin:0 0mm;"><font size="3" face="Arial"> <span style="font-size:12.0pt">In this short tutorial we are going to install and test Python on Windows XP Pro SP2. There are a few versions of Python available for download, for example:</span></font></p> <p style="margin:0 0mm;"><font size="3" face="Arial"> <span style="font-size:12.0pt">&nbsp;</span></font></p> <ol style="margin-top:0mm" start="1" type="1"> <li class="MsoNormal" style="margin-bottom:0mm;margin-bottom:.0001pt;line-height: normal"> <p style="line-height: 100%; margin-top: 0; margin-bottom: 0"> <font size="3" face="Arial"><span style="font-size:12.0pt">ActiveState&#39;s <a href="http://www.activestate.com/Products/ActivePython/" target="_blank" title="ActiveState's ActivePython"> ActivePython</a></span></font></p> </li> <li class="MsoNormal" style="margin-bottom:0mm;margin-bottom:.0001pt;line-height: normal"> <p style="line-height: 100%; margin-top: 0; margin-bottom: 0"> <font size="3" face="Arial"><span style="font-size:12.0pt">The official release of <a href="http://www.python.org/download/releases/" target="_blank" title="The official release of Python"> Python</a></span></font></p> </li> </ol> <p style="margin:0 0mm;"><font size="3" face="Arial"> <span style="font-size:12.0pt">&nbsp;</span></font></p> <p style="margin:0 0mm;"><font size="3" face="Arial"> <span style="font-size:12.0pt">There is also <a href="http://jython.org/" title="Jython - python for Java">Jython</a> and <a href="http://www.codeplex.com/Wiki/View.aspx?ProjectName=IronPython" title="IronPython - python for .NET"> IronPython</a>, but both of these are for special platforms that are for <a href="http://java.sun.com/" title="python for Java">Java</a> and <a href="http://www.microsoft.com/net/" title="python for .NET">.NET</a>, respectively. Another one is from Chilkat which provides python module. Example python codes can be found at: <a href="http://www.example-code.com/python/default.asp" target="_blank" title="python code examples"> Chilkat Python Code Example</a>. In this tutorial we are using Python from python.org. Please download the MSI, latest stable version from: <a href="http://www.python.org/download/" target="_blank" title="python official site"> python.org</a>. Double click the MSI file.</span></font></p> <p style="margin:0 0mm;"><font size="3" face="Arial"> <span style="font-size:12.0pt">&nbsp;</span></font></p> <p class="MsoNormal" align="center" style="margin-bottom:0mm;margin-bottom:0; text-align:center; line-height:100%; margin-top:0"><font size="3" face="Arial"> <span style="font-size: 12.0pt;line-height:115%"> <img border="0" width="436" height="253" src="pythononwindowsxp_files/pythonwindowsinstalltest001.png" alt="python for Windows MSI file ready to be run" /></span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%">&nbsp;</span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%"> Click the Run button.</span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%">&nbsp;</span></font></p> <p class="MsoNormal" align="center" style="margin-bottom:0mm;margin-bottom:0; text-align:center; line-height:100%; margin-top:0"><font size="3" face="Arial"> <span style="font-size: 12.0pt;line-height:115%"> <img border="0" width="404" height="309" src="pythononwindowsxp_files/pythonwindowsinstalltest002.png" alt="Windows Security warning message page for unsigned software" /></span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%">&nbsp;</span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%"> Select the Windows user access. In this case we select Install for all users and click Next.</span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%">&nbsp;</span></font></p> <p class="MsoNormal" align="center" style="margin-bottom:0mm;margin-bottom:0; text-align:center; line-height:100%; margin-top:0"><font size="3" face="Arial"> <span style="font-size: 12.0pt;line-height:115%"> <img border="0" width="499" height="432" src="pythononwindowsxp_files/pythonwindowsinstalltest003.png" alt="Python user selection option for Windows" /></span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%">&nbsp;</span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%"> Select the destination directory. In this case we just accept the default. Click Next.</span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%">&nbsp;</span></font></p> <p class="MsoNormal" align="center" style="margin-bottom:0mm;margin-bottom:0; text-align:center; line-height:100%; margin-top:0"><font size="3" face="Arial"> <span style="font-size: 12.0pt;line-height:115%"> <img border="0" width="499" height="432" src="pythononwindowsxp_files/pythonwindowsinstalltest004.png" alt="python destination installation directory" /></span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%">&nbsp;</span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%"> Select the features that you want to install. In this case we select all the available features. You can check the disk usage for installation by clicking the Disk Usage button. Click the Next button after viewing/setting the disk usage and advanced option.</span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%">&nbsp;</span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%">&nbsp;</span></font></p> <p class="MsoNormal" align="center" style="margin-bottom:0mm;margin-bottom:0; text-align:center; line-height:100%; margin-top:0"><font size="3" face="Arial"> <span style="font-size: 12.0pt;line-height:115%"> <img border="0" width="499" height="432" src="pythononwindowsxp_files/pythonwindowsinstalltest005.png" alt="python features installation selection page" /></span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%">&nbsp;</span></font></p> <p class="MsoNormal" align="center" style="margin-bottom:0mm;margin-bottom:0; text-align:center; line-height:100%; margin-top:0"><font size="3" face="Arial"> <span style="font-size: 12.0pt;line-height:115%"> <img border="0" width="499" height="432" src="pythononwindowsxp_files/pythonwindowsinstalltest006.png" alt="python for Windows installation disk usage" /></span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%">&nbsp;</span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%"> The Advanced button provides an option to compile .py files into byte code after installation. In this case we de e-select this option.</span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%">&nbsp;</span></font></p> <p class="MsoNormal" align="center" style="margin-bottom:0mm;margin-bottom:0; text-align:center; line-height:100%; margin-top:0"><font size="3" face="Arial"> <span style="font-size: 12.0pt;line-height:115%"> <img border="0" width="499" height="432" src="pythononwindowsxp_files/pythonwindowsinstalltest007.png" alt="python for Windows .py option selection" /></span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%">&nbsp;</span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%"> The installation should starts.</span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> &nbsp;</p> <table border="0" width="100%"> <tr> <td> <p align="center"><font size="3" face="Arial"> <span style="font-size: 12.0pt;line-height:115%"> <img border="0" width="499" height="432" src="pythononwindowsxp_files/pythonwindowsinstalltest008.png" alt="python for Windows installation start" /></span></font></td> <td style="border-left-style: solid; border-left-width: 2px"><script type="text/javascript"><!-- google_ad_client = "pub-8089415323104206"; /* 300x250, created 5/16/08javaos */ google_ad_slot = "8146009330"; google_ad_width = 300; google_ad_height = 250; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script></td> </tr> </table> <p class="MsoNormal" align="center" style="margin-bottom:0mm;margin-bottom:0; text-align:left; line-height:100%; margin-top:0">&nbsp;</p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%">&nbsp;</span></font></p> <p class="MsoNormal" align="center" style="margin-bottom:0mm;margin-bottom:0; text-align:center; line-height:100%; margin-top:0"><font size="3" face="Arial"> <span style="font-size: 12.0pt;line-height:115%"> <img border="0" width="499" height="432" src="pythononwindowsxp_files/pythonwindowsinstalltest009.png" alt="python for Windows installation progress" /></span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%">&nbsp;</span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%"> Click Finish button to complete python installation.</span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%">&nbsp;</span></font></p> <p class="MsoNormal" align="center" style="margin-bottom:0mm;margin-bottom:0; text-align:center; line-height:100%; margin-top:0"><font size="3" face="Arial"> <span style="font-size: 12.0pt;line-height:115%"> <img border="0" width="499" height="432" src="pythononwindowsxp_files/pythonwindowsinstalltest010.png" alt="python for Windows installation completed successfully" /></span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%">&nbsp;</span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%"> The short cut menus are shown below. Let run the python command line tool. Select Python (command line) menu.</span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%">&nbsp;</span></font></p> <p class="MsoNormal" align="center" style="margin-bottom:0mm;margin-bottom:0; text-align:center; line-height:100%; margin-top:0"><font size="3" face="Arial"> <span style="font-size: 12.0pt;line-height:115%"> <img border="0" width="439" height="121" src="pythononwindowsxp_files/pythonwindowsinstalltest011.png" alt="python for Windows start up menus" /></span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%">&nbsp;</span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%"> Type help() at the command prompt.</span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%">&nbsp;</span></font></p> <p class="MsoNormal" align="center" style="margin-bottom:0mm;margin-bottom:0; text-align:center; line-height:100%; margin-top:0"><font size="3" face="Arial"> <span style="font-size: 12.0pt;line-height:115%"> <img border="0" width="621" height="655" src="pythononwindowsxp_files/pythonwindowsinstalltest012.png" alt="python for Windows run from Windows command line" /></span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%">&nbsp;</span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%"> Well, our python on Windows XP Pro should be working. You can try many sample codes from <a href="http://www.tutorialspoint.com/python/index.htm" target="_blank">python tutorial</a>. The following script test the print() routine from command line.</span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%">&nbsp;</span></font></p> <p class="MsoNormal" align="center" style="margin-bottom:0mm;margin-bottom:0; text-align:center; line-height:100%; margin-top:0"><font size="3" face="Arial"> <span style="font-size: 12.0pt;line-height:115%"> <img border="0" width="589" height="163" src="pythononwindowsxp_files/pythonwindowsinstalltest013.png" alt="python for Windows - running python routine from Windows command line" /></span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%">&nbsp;</span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%"> Next, let test the same print() routine using the IDLE the python GUI. IDLE documentation can be found at: <a href="http://docs.python.org/library/idle.html" target="_blank">Python IDLE documentation</a>.</span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%">&nbsp;</span></font></p> <p class="MsoNormal" align="center" style="margin-bottom:0mm;margin-bottom:0; text-align:center; line-height:100%; margin-top:0"><font size="3" face="Arial"> <span style="font-size: 12.0pt;line-height:115%"> <img border="0" width="424" height="121" src="pythononwindowsxp_files/pythonwindowsinstalltest014.png" alt="python for Windows - python Windows GUI (IDLE) short cut menu" /></span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%">&nbsp;</span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%"> The following screenshot show a sample python script run using IDLE.</span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0"> <font size="3" face="Arial"><span style="font-size:12.0pt;line-height:115%">&nbsp;</span></font></p> <p class="MsoNormal" align="center" style="margin-bottom:0mm;margin-bottom:0; text-align:center; line-height:100%; margin-top:0"><font size="3" face="Arial"> <span style="font-size: 12.0pt;line-height:115%"> <img border="0" width="553" height="350" src="pythononwindowsxp_files/pythonwindowsinstalltest015.png" alt="python for Windows running python script/routine from IDLE/Windows GUI" /></span></font></p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0">&nbsp;</p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0">&nbsp;</p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0">&nbsp;</p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0">&nbsp;</p> <p class="MsoNormal" style="margin-bottom:0mm;margin-bottom:0; line-height:100%; margin-top:0" align="center"><script type="text/javascript"><!-- google_ad_client = "pub-8089415323104206"; /* 728x15, created 5/16/08javaos */ google_ad_slot = "3545464564"; google_ad_width = 728; google_ad_height = 15; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script></p> <hr color="#FF0000" /> <p class="MsoNormal" style="line-height: 100%; margin-top: 0; margin-bottom: 0" align="center"> <font face="Arial" size="5"> <a title="The Java and open source applications" target="_top" href="http://www.javaguicodexample.com/"> Back to Main</a></font></p> <p class="MsoNormal" style="line-height: 100%; margin-top: 0; margin-bottom: 0" align="left"> &nbsp;</p> <p class="MsoNormal" style="line-height: 100%; margin-top: 0; margin-bottom: 0" align="center"> <script src="http://tag.contextweb.com/TagPublish/getjs.aspx?action=VIEWAD&cwrun=200&cwadformat=728X90&cwpid=527221&cwwidth=728&cwheight=90&cwpnet=1&cwtagid=85440"></script></p> </div> </body> </html>