Section B.1. Installing Python
This section gives an overview of install-related details -- instructions for putting the Python interpreter on your computer.
B.1.1 Windows
Python install details vary per platform and are described in the resources just listed. But as an overview, Windows users will find a Python self-installer executable at http://examples.oreilly.com/python2 (see the top-level Python 1.5.2 and 2.0 directories). Simply double-click the installer program and answer "yes," "next," or "default" to step through a default Windows install. Be sure to install Tcl/Tk too, if you are asked about it along the way.
After the install, you will find an entry for Python in your Start buttons Programs menu; it includes options for running both the IDLE integrated GUI development interface and the command-line console session, viewing Pythons standard manuals, and more. Pythons manuals are installed with the interpreter in HTML form, and open locally in a web browser when selected.
Python also registers itself to open Python files on Windows, so you can simply click on Python scripts in a Windows file explorer window to launch them. You can also run Python scripts by typing python file.py command lines at any DOS command-line prompt, provided that the directory containing the python.exe Python interpreter program is added to your PATH DOS shell variable (see the configuration and running sections later).
Note that the standard Python package for Windows includes full Tkinter support. You do not need to install other packages or perform any extra install steps to run Tkinter GUIs on Windows; simply install Python. All necessary Tkinter components are installed by the Python self-installer, and Python automatically finds the necessary components without extra environment settings. The Windows install also includes the bsddb extension to support DBM-style files.
If you plan on doing any Windows-specific work such as COM development, you will probably want to install the extra win32all extensions package (available at http://examples.oreilly.com/python2 as well as at http://www.python.org). This package registers Python for Active Scripting, provides MFC wrappers and COM integration, and more (see Chapter 15). Also note that Python distributions available from other sources (e.g., the ActivePython distribution from ActiveState, http://www.activestate.com) may include both Python and the Windows extensions package.
B.1.2 Unix and Linux
Python may already be available on these platforms (its often installed as a standard part of Linux these days); check your /usr/bin and /usr/local/bin directories to see if a Python interpreter is lurking there. If not, Python is generally installed on these platforms from either an rpm package (which installs Python executables and libraries automatically) or the source code distribution package (which you unpack and compile locally on your computer). Compiling Python from its source on Linux is a trivial task -- usually just a matter of typing two or three simple command lines. See the Python source distributions top-level README files and Linux rpm documentation for more details.
B.1.3 Macintosh and Others
Please see the documentation associated with the Macintosh ports for install and usage details. For other platforms, you will likely need to find ports at http://www.python.org and consult the ports install notes or documentation.
Категории