Mac
OS
Python on X
In Mac
OS
X, for python Installation
There are two options: install or not install. You may want to install it.
Mac
OS
X 10.2 and later versions have pre-installed a python
Command Line version.
If you are used to using command line, you can use it to finish 1/3 of the book. However, the pre-installed version does not contain XML
Parser, so when you learn XML
You need to install the full version.
You can also install the latest full version of the GUI shell that is better than the pre-installed version.
Process 1.3. On Mac
OS
Run the pre-installed Python version on X.
Use pre-installed Python
Steps for version:
Open/Applications
Folder.
OpenUtilities
Folder.
Double-clickTerminal
Open a terminal and enter the command line window.
TypePython
.
Test:
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%
Process 1.4. On Mac
OS
Install the latest Python version on X
The following describes how to download and install Python
Process of the latest version:
From http://homepages.cwi.nl /~ Jack/macpython/download.html
DownloadMacpython-OSX
Disk image.
Download complete. Double-clickMacPython-OSX-2.3-1.dmg
Mount the disk image to the desktop.
Double-click the installerMacPython-OSX.pkg
.
The installer prompts your administrator username and password.
Follow the prompts of the installation program.
After installation, close the installer and open/Applications
Folder.
OpenMacPython-2.3
Folder.
Double-clickPythonide
To run Python
.
Macpython
IDE
A pop-up screen will show you in the interactive shell. If the interactive shell does not appear, select Window
-> Python interactive
(CMD
-0
). You will see information similar to the following:
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 the pre-installed version still exists once the latest version is installed. If you run the script from the command line, you need to know which version of python is in use
.
Example 1.1. Two Python
Version
[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%