forked from joshgachnang/diveintopython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmacosx.html
More file actions
183 lines (179 loc) · 11.2 KB
/
macosx.html
File metadata and controls
183 lines (179 loc) · 11.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<!DOCTYPE html
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>1.3. Python on Mac OS X</title>
<link rel="stylesheet" href="/css/diveintopython.css" type="text/css" />
<meta name="generator" content="DocBook XSL Stylesheets V1.52.2" />
<meta name="keywords" content="Python, Dive Into Python, tutorial, object-oriented, programming, documentation, book, free" />
<meta name="description" content="Python from novice to pro" />
<link rel="home" href="http://www.diveintopython.net/" title="Dive Into Python" />
<link rel="up" href="http://www.diveintopython.net/" title="Chapter 1. Installing Python" />
<link rel="previous" href="http://www.diveintopython.net/" title="1.2. Python on Windows" />
<link rel="next" href="http://www.diveintopython.net/" title="1.4. Python on Mac OS 9" />
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-9740779-18']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script></head>
<body>
<style type="text/css">body{margin-top:0!important;padding-top:0!important;min-width:800px!important;}#wm-ipp a:hover{text-decoration:underline!important;}</style>
<table id="Header" width="100%" border="0" cellpadding="0" cellspacing="0" summary="">
<tr>
<td id="breadcrumb" colspan="5" align="left" valign="top">You are here: <a href="http://www.diveintopython.net/index.html">Home</a> > <a href="http://www.diveintopython.net/toc/index.html">Dive Into Python</a> > <a href="http://www.diveintopython.net/installing_python/index.html">Installing Python</a> > <span class="thispage">Python on Mac OS X</span></td>
<td id="navigation" align="right" valign="top"> <a href="http://www.diveintopython.net/installing_python/windows.html" title="Prev: “Python on Windows”"><<</a> <a href="http://www.diveintopython.net/installing_python/macos9.html" title="Next: “Python on Mac OS 9”">>></a></td>
</tr>
<tr>
<td colspan="3" id="logocontainer">
<h1 id="logo"><a href="http://www.diveintopython.net/index.html" accesskey="1">Dive Into Python</a></h1>
<p id="tagline">Python from novice to pro</p>
</td>
<td colspan="3" align="right">
<form id="search" method="GET" action="http://www.google.com/custom">
<p><label for="q" accesskey="4">Find: </label><input type="text" id="q" name="q" size="20" maxlength="255" value=" " /> <input type="submit" value="Search" /><input type="hidden" name="cof" value="LW:752;L:http://diveintopython.org/images/diveintopython.png;LH:42;AH:left;GL:0;AWFID:3ced2bb1f7f1b212;" /><input type="hidden" name="domains" value="diveintopython.org" /><input type="hidden" name="sitesearch" value="diveintopython.org" /></p>
</form>
</td>
</tr>
</table>
<div class="section" lang="en">
<div class="titlepage">
<div>
<div>
<h2 class="title"><a name="install.macosx"></a>1.3. <span class="application">Python</span> on <span class="abbrev">Mac</span> <span class="acronym">OS</span> X
</h2>
</div>
</div>
<div></div>
</div>
<div class="abstract">
<p>On <span class="abbrev">Mac</span> <span class="acronym">OS</span> X, you have two choices for installing <span class="application">Python</span>: install it, or don't install it. You probably want to install it.
</p>
</div>
<p><span class="abbrev">Mac</span> <span class="acronym">OS</span> X 10.2 and later comes with a command-line version of <span class="application">Python</span> 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 <span class="acronym">XML</span> parser, so when you get to the <span class="acronym">XML</span> chapter, you'll need to install the full version.
</p>
<p>Rather than using the preinstalled version, you'll probably want to install the latest version, which also comes with a graphical
interactive shell.
</p>
<div class="procedure">
<h3 class="title">Procedure 1.3. Running the Preinstalled Version of <span class="application">Python</span> on <span class="abbrev">Mac</span> <span class="acronym">OS</span> X
</h3>
<p>To use the preinstalled version of <span class="application">Python</span>, follow these steps:
</p>
<ol type="1">
<li>
<p>Open the <tt class="filename">/Applications</tt> folder.
</p>
</li>
<li>
<p>Open the <tt class="filename">Utilities</tt> folder.
</p>
</li>
<li>
<p>Double-click <tt class="filename">Terminal</tt> to open a terminal window and get to a command line.
</p>
</li>
<li>
<p>Type <b class="userinput"><tt>python</tt></b> at the command prompt.
</p>
</li>
</ol>
</div>
<p>Try it out:</p>
<div class="informalexample"><pre class="screen">
<span class="computeroutput">Welcome to Darwin!</span>
<tt class="prompt">[localhost:~] you% </tt><span class="userinput">python</span>
<span class="computeroutput">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.</span>
<tt class="prompt">>>> </tt><span class="userinput">[press Ctrl+D to get back to the command prompt]</span>
<tt class="prompt">[localhost:~] you% </tt>
</pre></div>
<div class="procedure">
<h3 class="title">Procedure 1.4. Installing the Latest Version of <span class="application">Python</span> on <span class="abbrev">Mac</span> <span class="acronym">OS</span> X
</h3>
<p>Follow these steps to download and install the latest version of <span class="application">Python</span>:
</p>
<ol type="1">
<li>
<p>Download the <tt class="filename">MacPython-OSX</tt> disk image from <a href="http://www.diveintopython.net/~jack/macpython/download.html">http://homepages.cwi.nl/~jack/macpython/download.html</a>.
</p>
</li>
<li>
<p>If your browser has not already done so, double-click <tt class="filename">MacPython-OSX-2.3-1.dmg</tt> to mount the disk image on your desktop.
</p>
</li>
<li>
<p>Double-click the installer, <tt class="filename">MacPython-OSX.pkg</tt>.
</p>
</li>
<li>
<p>The installer will prompt you for your administrative username and password.</p>
</li>
<li>
<p>Step through the installer program.</p>
</li>
<li>
<p>After installation is complete, close the installer and open the <tt class="filename">/Applications</tt> folder.
</p>
</li>
<li>
<p>Open the <tt class="filename">MacPython-2.3</tt> folder
</p>
</li>
<li>
<p>Double-click <tt class="filename">PythonIDE</tt> to launch <span class="application">Python</span>.
</p>
</li>
</ol>
</div>
<p>The <span class="application">MacPython</span> <span class="acronym">IDE</span> should display a splash screen, then take you to the interactive shell. If the interactive shell does not appear, select
<span class="guimenu">Window</span>-><span class="guimenuitem">Python Interactive</span> (<span><b class="shortcut"><span></span></b><b class="keycap">Cmd</b></span>-<span class="keysym">0</span>). The opening window will look something like this:
</p>
<div class="informalexample"><pre class="screen">
<span class="computeroutput">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</span>
<tt class="prompt">>>> </tt>
</pre></div>
<p>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 <span class="application">Python</span> you are using.
</p>
<div class="example"><a name="d0e3331"></a><h3 class="title">Example 1.1. Two versions of <span class="application">Python</span></h3><pre class="screen">
<tt class="prompt">[localhost:~] you% </tt><span class="userinput">python</span>
<span class="computeroutput">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.</span>
<tt class="prompt">>>> </tt><span class="userinput">[press Ctrl+D to get back to the command prompt]</span>
<tt class="prompt">[localhost:~] you% </tt><span class="userinput">/usr/local/bin/python</span>
<span class="computeroutput">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.</span>
<tt class="prompt">>>> </tt><span class="userinput">[press Ctrl+D to get back to the command prompt]</span>
<tt class="prompt">[localhost:~] you% </tt>
</pre></div>
</div>
<table class="Footer" width="100%" border="0" cellpadding="0" cellspacing="0" summary="">
<tr>
<td width="35%" align="left"><br /><a class="NavigationArrow" href="http://www.diveintopython.net/installing_python/windows.html"><< Python on Windows</a></td>
<td width="30%" align="center"><br /> <span class="divider">|</span> <a href="http://www.diveintopython.net/installing_python/index.html#install.choosing" title="1.1. Which Python is right for you?">1</a> <span class="divider">|</span> <a href="http://www.diveintopython.net/installing_python/windows.html" title="1.2. Python on Windows">2</a> <span class="divider">|</span> <span class="thispage">3</span> <span class="divider">|</span> <a href="http://www.diveintopython.net/installing_python/macos9.html" title="1.4. Python on Mac OS 9">4</a> <span class="divider">|</span> <a href="http://www.diveintopython.net/installing_python/redhat.html" title="1.5. Python on RedHat Linux">5</a> <span class="divider">|</span> <a href="http://www.diveintopython.net/installing_python/debian.html" title="1.6. Python on Debian GNU/Linux">6</a> <span class="divider">|</span> <a href="http://www.diveintopython.net/installing_python/source.html" title="1.7. Python Installation from Source">7</a> <span class="divider">|</span> <a href="http://www.diveintopython.net/installing_python/shell.html" title="1.8. The Interactive Shell">8</a> <span class="divider">|</span> <a href="http://www.diveintopython.net/installing_python/summary.html" title="1.9. Summary">9</a> <span class="divider">|</span>
</td>
<td width="35%" align="right"><br /><a class="NavigationArrow" href="http://www.diveintopython.net/installing_python/macos9.html">Python on Mac OS 9 >></a></td>
</tr>
<tr>
<td colspan="3"><br /></td>
</tr>
</table>
<div class="Footer">
<p class="copyright">Copyright © 2000, 2001, 2002, 2003, 2004 <a href="mailto:[email protected]">Mark Pilgrim</a></p>
</div>
</body>
</html>