You are here: Home > Dive Into Python > Installing Python > Python on Mac OS X | << >> | ||||
Dive Into PythonPython from novice to pro |
On Mac OS X, you have two choices for installing Python: install it, or don't install it. You probably want to install it.
Mac OS X 10.2 and later comes with a command-line version of Python preinstalled. If you are comfortable with the command line, you can use this version for the first third of the book. However, the preinstalled version does not come with an XML parser, so when you get to the XML chapter, you'll need to install the full version.
Rather than using the preinstalled version, you'll probably want to install the latest version, which also comes with a graphical interactive shell.
To use the preinstalled version of Python, follow these steps:
Open the /Applications folder.
Open the Utilities folder.
Double-click Terminal to open a terminal window and get to a command line.
Type python at the command prompt.
Try it out:
Welcome to Darwin! [localhost:~] you% python Python 2.2 (#1, 07/14/02, 23:25:09) [GCC Apple cpp-precomp 6.14] on darwin Type "help", "copyright", "credits", or "license" for more information. >>> [press Ctrl+D to get back to the command prompt] [localhost:~] you%
Follow these steps to download and install the latest version of Python:
Download the MacPython-OSX disk image from http://homepages.cwi.nl/~jack/macpython/download.php.
If your browser has not already done so, double-click MacPython-OSX-2.3-1.dmg to mount the disk image on your desktop.
Double-click the installer, MacPython-OSX.pkg.
The installer will prompt you for your administrative username and password.
Step through the installer program.
After installation is complete, close the installer and open the /Applications folder.
Open the MacPython-2.3 folder
Double-click PythonIDE to launch Python.
The MacPython IDE should display a splash screen, then take you to the interactive shell. If the interactive shell does not appear, select -> (Cmd-0). The opening window will look something like this:
Python 2.3 (#2, Jul 30 2003, 11:45:28)
[GCC 3.1 20020420 (prerelease)]
Type "copyright", "credits" or "license" for more information.
MacPython IDE 1.0.1
>>>
Note that once you install the latest version, the pre-installed version is still present. If you are running scripts from the command line, you need to be aware which version of Python you are using.
[localhost:~] you% python Python 2.2 (#1, 07/14/02, 23:25:09) [GCC Apple cpp-precomp 6.14] on darwin Type "help", "copyright", "credits", or "license" for more information. >>> [press Ctrl+D to get back to the command prompt] [localhost:~] you% /usr/local/bin/python Python 2.3 (#2, Jul 30 2003, 11:45:28) [GCC 3.1 20020420 (prerelease)] on darwin Type "help", "copyright", "credits", or "license" for more information. >>> [press Ctrl+D to get back to the command prompt] [localhost:~] you%
<< Python on Windows |
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | |
Python on Mac OS 9 >> |