Section 1.4. Downloading and Installing Python


1.4. Downloading and Installing Python

The most obvious place to get all Python-related software is at the main Web site at http://python.org. For your convenience, you can also go to the book's Web site at http://corepython.com and click on the "Install Python" link to the leftwe have organized a grid with most contemporary versions of Python for the most platforms, with a focus, of course, on the "Big Three." Unix, Win 32, MacOS X.

As we alluded to earlier in Section 1.3.5, Python is available on a wide variety of platforms. They can be broken down into these basic categories and available platforms:

  • All Unix flavors (Linux, MacOS X, Solaris, FreeBSD, etc.)

  • Win32 (Windows NT, 2000, XP, etc.)

  • Older platforms: MacOS 8/9, Windows 3.x, DOS, OS/2, AIX

  • Handhelds (PDAs/phones): Nokia Series 60/SymbianOS, Windows CE/Pocket PC, Sharp Zaurus/arm-linux, PalmOS

  • Gaming consoles: Sony PS2, PSP; Nintendo GameCube

  • Real-Time platforms: VxWorks, QNX

  • Alternative implementations: Jython, IronPython, stackless

  • Others

The most recent versions of Python will likely be found only on "the Big Three." In fact, current versions of Linux and MacOS X already come with Python installedyou'll have to check to see which Python release it is. Other versions will be older 2.x releases while some have yet to progress beyond 1.5. Some come with binaries to install directly while others require you to build Python manually before installation.

Unix (Linux, MacOS X, Solaris, *BSD, etc.)

As mentioned above, your Unix-based system may already have Python installed. The best way to check is to run Python from the command line and see if it is both in your path and available. Just type:

myMac:~ wesley$ python Python 2.4 (#4, Mar 19 2005, 03:25:10) [GCC 3.3 20030304 (Apple Computer, Inc. build 1671)] on darwin Type "help", "copyright", "credits" or "license" for more information. ">>>"


If starting Python fails, it doesn't mean it's not installed, just that it's not in your path. Hunt around for it, and if you're unsuccessful, try building it manually, which isn't very difficult (see "Build It Yourself" on the next page). If you're using certain versions of Linux, you can get the binary or source RPMs.

Windows/DOS

Download the .msi file from python.org or corepython.com as described previously (i.e., python-2.5.msi) and execute it to install Python. If you are planning on doing any kind of Win32 development, such as with COM, MFC, or need any of the Win32 libraries, we also strongly suggest that you download and install the Python for Windows Extensions. You can then run Python from a DOS command window or via one of the IDEs, IDLE, the default Python IDE, or PythonWin, the IDE that comes with the Windows Extensions distribution.

Build It Yourself

For most other platforms, download the .tgz file,. extract the files, and go to the main directory. Build Python by performing the following:

  1. ./configure

  2. make

  3. make install

Python is usually installed in a standard location so you can find it rather easily. It has become quite commonplace for systems today to have multiple versions of Python installed. While it is easy to find the binary executable, you also have to deal with where the libraries are installed.

On Unix machines, the executable is usually installed in /usr/local/bin while the libraries are in /usr/local/lib/python2.x where the 2.x is the version of Python you are using. For MacOS X, Python is installed in /sw/bin and/or /usr/local/bin, and the libraries are in /sw/lib,/usr/local /lib, and/or /Library/Frameworks/Python.framework/Versions.

On Windows, the default installation area is C:\Python2x. TRy to avoid installing Python in C:\Program Files. Yes, we know it's the general place to put installed programs, but DOS does not support those types of long names; it is usually aliased as Progra~1. This may also lead to problems running some programs, so it's best to avoid it. So, let's say you installed Python in C:\Python, then the standard library files are typically installed in C:\Python\Lib.



Core Python Programming
Core Python Programming (2nd Edition)
ISBN: 0132269937
EAN: 2147483647
Year: 2004
Pages: 334
Authors: Wesley J Chun

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net