Installing Python on Windows

Installing Python on Windows



Downloading and Installing Python

  1. First we must download the proper installation package. Visit here to visit the site pictured below.

    Click on the circled link labeled individual releases.
  2. You will be taken to a list of Python releases. Choose 2.5.1 which is the first one.
  3. Most of you will download the installation package for Windows XP running on an x86 machine (circled in red). If you are using an Itanium or AMD 64-bit machine, you will need to use one of the other installation packages pictured below. If you are not sure, right click on My Computer and choose Properties.
    This also assumes that you have Windows XP. If you have an earlier version of windows, you will need to download Microsoft Installer. The link is next to the second balloon in the image below.
  4. If you are using Firefox the following box will appear. Click Save File. You can monitor the download using the Download Manager by accessing the Tools menu and then selecting Downloads.
    Once the download is complete, click on Open to start the installer.
    If you are using Internet Explorer the following box will appear when you click on the link. Click on Run.
    I think we can trust this download, so click Run.
  5. The Python installer should open. Select who you want to have access to Python: just yourself, or anyone on the system. If you are the only one that uses your computer, then it does not really matter which one you choose. Just choose one and click Next.
  6. Next, choose a directory where Python should be installed. You should really just leave it as is and click Next.
  7. Accept the default installation options in this screen and click Next
    . 
  8. Python will begin installing on your system. In just a few minutes you will have the world's greatest language on your own computer!
  9. The installer should complete, yielding the following screen. Click Finish.
Now what? Let's look at what was installed.


Using the Windows Python Installation

  1. Click on the Start menu and find the Python 2.5.1 program group. We see that a few things have been installed.
    • IDLE (Python GUI) which is like the command line Python prompt on the servers except it has a graphical user interface (menus, buttons, etc.)
    • Module Docs which is a help file consisting of documentation on the installed Python modules.
    • Python (command line) which looks just like the prompt on the servers. 
    • Python Manuals for help when you need it.
    • Uninstall Python which you will NEVER EVER use.
NOTE! You will not be able to access Python by typing python at the command prompt until we have set the PATH variable in Windows. We will get to this in the next section: 


Installing a Package Manager

Eventually, actually rather quickly, you will find that you need to install an additional module that is not contained in the Python standard distribution. For this, we need to install a Package Manager that will allow us to install new packages into Python. I have chosenEasyInstall which is fairly easy to setup.
  1. Click on Installing "Easy Install"
  2. Right click on the link ez_setup.py and choose Save Link As... or Save Target As....
  3. Locate the ez_setup.py on your computer and double-click it to run it. It will run within Python and install.
  4. IMPORTANT. You need to set the path variable in Windows XP so it knows where to look for Python when you enter python or easy_install.
    1. Right click on My Computer and choose Properties.
    2. The following screen appears. Click on Advanced.
    3. The following pane appears. Click on Environment Variables.
    4. Depending on how you installed Python (for all users or just you) these directions may be different. Assuming you installed Python just for yourself, click on Path in the part of the box for User variables. Click Edit
    5. The following box appears. In the Variable value box, position the cursor after the semicolon (;) denoting the last entry.
      Enter C:\Python25\Scripts; as the last entry in this box. Do not forget the semicolon at the end!
      Click OK three more times to exit out of System Properties.
  5. Open a command prompt by choosing Run from the Start Menu and entering cmd followed by clicking OK.
  6. The following box appears. Type easy_install BeautifulSoup to install the BeautifulSoup module that we will be using.
     The module will be installed.
  7. When you are returned to the command prompt, type python and hit ENTER.
  8. Type import BeautifulSoup
    We see that another prompt appears without an error. We know that the PATH variable is set properly now and that the EasyInstall package manager was installed properly.
    We also know how to install new packages!

    Let the Fun Begin!!!


    Return to 202A Page

Đăng nhận xét

Mới hơn Cũ hơn