Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / amd64 / html / python / inst / alt-install-windows.html
CommitLineData
920dae64
AT
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<link rel="STYLESHEET" href="inst.css" type='text/css' />
5<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
6<link rel='start' href='../index.html' title='Python Documentation Index' />
7<link rel="first" href="inst.html" title='Installing Python Modules' />
8<link rel='last' href='about.html' title='About this document...' />
9<link rel='help' href='about.html' title='About this document...' />
10<link rel="next" href="search-path.html" />
11<link rel="prev" href="standard-install.html" />
12<link rel="parent" href="inst.html" />
13<link rel="next" href="search-path.html" />
14<meta name='aesop' content='information' />
15<title>3 Alternate Installation</title>
16</head>
17<body>
18<DIV CLASS="navigation">
19<div id='top-navigation-panel' xml:id='top-navigation-panel'>
20<table align="center" width="100%" cellpadding="0" cellspacing="2">
21<tr>
22<td class='online-navigation'><a rel="prev" title="2 Standard Build and"
23 href="standard-install.html"><img src='../icons/previous.png'
24 border='0' height='32' alt='Previous Page' width='32' /></A></td>
25<td class='online-navigation'><a rel="parent" title="Installing Python Modules"
26 href="inst.html"><img src='../icons/up.png'
27 border='0' height='32' alt='Up One Level' width='32' /></A></td>
28<td class='online-navigation'><a rel="next" title="4 Custom Installation"
29 href="search-path.html"><img src='../icons/next.png'
30 border='0' height='32' alt='Next Page' width='32' /></A></td>
31<td align="center" width="100%">Installing Python Modules</td>
32<td class='online-navigation'><img src='../icons/blank.png'
33 border='0' height='32' alt='' width='32' /></td>
34<td class='online-navigation'><img src='../icons/blank.png'
35 border='0' height='32' alt='' width='32' /></td>
36<td class='online-navigation'><img src='../icons/blank.png'
37 border='0' height='32' alt='' width='32' /></td>
38</tr></table>
39<div class='online-navigation'>
40<b class="navlabel">Previous:</b>
41<a class="sectref" rel="prev" href="standard-install.html">2 Standard Build and</A>
42<b class="navlabel">Up:</b>
43<a class="sectref" rel="parent" href="inst.html">Installing Python Modules</A>
44<b class="navlabel">Next:</b>
45<a class="sectref" rel="next" href="search-path.html">4 Custom Installation</A>
46</div>
47<hr /></div>
48</DIV>
49<!--End of Navigation Panel-->
50<div class='online-navigation'>
51<!--Table of Child-Links-->
52<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></a>
53
54<UL CLASS="ChildLinks">
55<LI><A href="alt-install-windows.html#SECTION000310000000000000000">3.1 Alternate installation: the home scheme</a>
56<LI><A href="alt-install-windows.html#SECTION000320000000000000000">3.2 Alternate installation: <span class="Unix">Unix</span> (the prefix scheme)</a>
57<LI><A href="alt-install-windows.html#SECTION000330000000000000000">3.3 Alternate installation: Windows (the prefix scheme)</a>
58</ul>
59<!--End of Table of Child-Links-->
60</div>
61<HR>
62
63<H1><A NAME="SECTION000300000000000000000"></A>
64<A NAME="alt-install"></A>
65<BR>
663 Alternate Installation
67</H1>
68
69<P>
70Often, it is necessary or desirable to install modules to a location
71other than the standard location for third-party Python modules. For
72example, on a <span class="Unix">Unix</span> system you might not have permission to write to the
73standard third-party module directory. Or you might wish to try out a
74module before making it a standard part of your local Python
75installation. This is especially true when upgrading a distribution
76already present: you want to make sure your existing base of scripts
77still works with the new version before actually upgrading.
78
79<P>
80The Distutils <code class="du-command">install</code> command is designed to make installing
81module distributions to an alternate location simple and painless. The
82basic idea is that you supply a base directory for the installation, and
83the <code class="du-command">install</code> command picks a set of directories (called an
84<em>installation scheme</em>) under this base directory in which to
85install files. The details differ across platforms, so read whichever
86of the following sections applies to you.
87
88<P>
89
90<H2><A NAME="SECTION000310000000000000000"></A>
91<A NAME="alt-install-prefix"></A>
92<BR>
933.1 Alternate installation: the home scheme
94</H2>
95
96<P>
97The idea behind the ``home scheme'' is that you build and maintain a
98personal stash of Python modules. This scheme's name is derived from
99the idea of a ``home'' directory on <span class="Unix">Unix</span>, since it's not unusual for
100a <span class="Unix">Unix</span> user to make their home directory have a layout similar to
101<span class="file">/usr/</span> or <span class="file">/usr/local/</span>. This scheme can be used by
102anyone, regardless of the operating system their installing for.
103
104<P>
105Installing a new module distribution is as simple as
106
107<P>
108<div class="verbatim"><pre>
109python setup.py install --home=&lt;dir&gt;
110</pre></div>
111
112<P>
113where you can supply any directory you like for the
114<b class="programopt">--home</b> option. On <span class="Unix">Unix</span>, lazy typists can just type a
115tilde (<code>~</code>); the <code class="du-command">install</code> command will
116expand this to your home directory:
117
118<P>
119<div class="verbatim"><pre>
120python setup.py install --home=~
121</pre></div>
122
123<P>
124The <b class="programopt">--home</b> option defines the installation base
125directory. Files are installed to the following directories under the
126installation base as follows:
127<div class="center"><table class="realtable">
128 <thead>
129 <tr>
130 <th class="left" >Type of file</th>
131 <th class="left" >Installation Directory</th>
132 <th class="left" >Override option</th>
133 </tr>
134 </thead>
135 <tbody>
136 <tr><td class="left" valign="baseline">pure module distribution</td>
137 <td class="left" ><span class="du-filevar">home</span><span class="file">/lib/python</span></td>
138 <td class="left" ><b class="programopt">--install-purelib</b></td></tr>
139 <tr><td class="left" valign="baseline">non-pure module distribution</td>
140 <td class="left" ><span class="du-filevar">home</span><span class="file">/lib/python</span></td>
141 <td class="left" ><b class="programopt">--install-platlib</b></td></tr>
142 <tr><td class="left" valign="baseline">scripts</td>
143 <td class="left" ><span class="du-filevar">home</span><span class="file">/bin</span></td>
144 <td class="left" ><b class="programopt">--install-scripts</b></td></tr>
145 <tr><td class="left" valign="baseline">data</td>
146 <td class="left" ><span class="du-filevar">home</span><span class="file">/share</span></td>
147 <td class="left" ><b class="programopt">--install-data</b></td></tr></tbody>
148</table></div>
149
150<P>
151
152<span class="versionnote">Changed in version 2.4:
153The <b class="programopt">--home</b> option used to be supported
154 only on <span class="Unix">Unix</span>.</span>
155
156<P>
157
158<H2><A NAME="SECTION000320000000000000000"></A>
159<A NAME="alt-install-home"></A>
160<BR>
1613.2 Alternate installation: <span class="Unix">Unix</span> (the prefix scheme)
162</H2>
163
164<P>
165The ``prefix scheme'' is useful when you wish to use one Python
166installation to perform the build/install (i.e., to run the setup
167script), but install modules into the third-party module directory of a
168different Python installation (or something that looks like a different
169Python installation). If this sounds a trifle unusual, it is--that's
170why the ``home scheme'' comes first. However, there are at least two
171known cases where the prefix scheme will be useful.
172
173<P>
174First, consider that many Linux distributions put Python in <span class="file">/usr</span>,
175rather than the more traditional <span class="file">/usr/local</span>. This is entirely
176appropriate, since in those cases Python is part of ``the system''
177rather than a local add-on. However, if you are installing Python
178modules from source, you probably want them to go in
179<span class="file">/usr/local/lib/python2.<span class="du-filevar">X</span></span> rather than
180<span class="file">/usr/lib/python2.<span class="du-filevar">X</span></span>. This can be done with
181
182<P>
183<div class="verbatim"><pre>
184/usr/bin/python setup.py install --prefix=/usr/local
185</pre></div>
186
187<P>
188Another possibility is a network filesystem where the name used to write
189to a remote directory is different from the name used to read it: for
190example, the Python interpreter accessed as <span class="file">/usr/local/bin/python</span>
191might search for modules in <span class="file">/usr/local/lib/python2.<span class="du-filevar">X</span></span>,
192but those modules would have to be installed to, say,
193<span class="file">/mnt/<span class="du-filevar">@server</span>/export/lib/python2.<span class="du-filevar">X</span></span>. This
194could be done with
195
196<P>
197<div class="verbatim"><pre>
198/usr/local/bin/python setup.py install --prefix=/mnt/@server/export
199</pre></div>
200
201<P>
202In either case, the <b class="programopt">--prefix</b> option defines the
203installation base, and the <b class="programopt">--exec-prefix</b> option defines
204the platform-specific installation base, which is used for
205platform-specific files. (Currently, this just means non-pure module
206distributions, but could be expanded to C libraries, binary executables,
207etc.) If <b class="programopt">--exec-prefix</b> is not supplied, it defaults to
208<b class="programopt">--prefix</b>. Files are installed as follows:
209
210<P>
211<div class="center"><table class="realtable">
212 <thead>
213 <tr>
214 <th class="left" >Type of file</th>
215 <th class="left" >Installation Directory</th>
216 <th class="left" >Override option</th>
217 </tr>
218 </thead>
219 <tbody>
220 <tr><td class="left" valign="baseline">pure module distribution</td>
221 <td class="left" ><span class="du-filevar">prefix</span><span class="file">/lib/python2.<span class="du-filevar">X</span>/site-packages</span></td>
222 <td class="left" ><b class="programopt">--install-purelib</b></td></tr>
223 <tr><td class="left" valign="baseline">non-pure module distribution</td>
224 <td class="left" ><span class="du-filevar">exec-prefix</span><span class="file">/lib/python2.<span class="du-filevar">X</span>/site-packages</span></td>
225 <td class="left" ><b class="programopt">--install-platlib</b></td></tr>
226 <tr><td class="left" valign="baseline">scripts</td>
227 <td class="left" ><span class="du-filevar">prefix</span><span class="file">/bin</span></td>
228 <td class="left" ><b class="programopt">--install-scripts</b></td></tr>
229 <tr><td class="left" valign="baseline">data</td>
230 <td class="left" ><span class="du-filevar">prefix</span><span class="file">/share</span></td>
231 <td class="left" ><b class="programopt">--install-data</b></td></tr></tbody>
232</table></div>
233
234<P>
235There is no requirement that <b class="programopt">--prefix</b> or
236<b class="programopt">--exec-prefix</b> actually point to an alternate Python
237installation; if the directories listed above do not already exist, they
238are created at installation time.
239
240<P>
241Incidentally, the real reason the prefix scheme is important is simply
242that a standard <span class="Unix">Unix</span> installation uses the prefix scheme, but with
243<b class="programopt">--prefix</b> and <b class="programopt">--exec-prefix</b> supplied by
244Python itself as <code>sys.prefix</code> and <code>sys.exec_prefix</code>. Thus,
245you might think you'll never use the prefix scheme, but every time you
246run <code>python setup.py install</code> without any other options, you're
247using it.
248
249<P>
250Note that installing extensions to an alternate Python installation has
251no effect on how those extensions are built: in particular, the Python
252header files (<span class="file">Python.h</span> and friends) installed with the Python
253interpreter used to run the setup script will be used in compiling
254extensions. It is your responsibility to ensure that the interpreter
255used to run extensions installed in this way is compatible with the
256interpreter used to build them. The best way to do this is to ensure
257that the two interpreters are the same version of Python (possibly
258different builds, or possibly copies of the same build). (Of course, if
259your <b class="programopt">--prefix</b> and <b class="programopt">--exec-prefix</b> don't even
260point to an alternate Python installation, this is immaterial.)
261
262<P>
263
264<H2><A NAME="SECTION000330000000000000000"></A>
265<A NAME="alt-install-windows"></A>
266<BR>
2673.3 Alternate installation: Windows (the prefix scheme)
268</H2>
269
270<P>
271Windows has no concept of a user's home directory, and since the
272standard Python installation under Windows is simpler than under
273<span class="Unix">Unix</span>, the <b class="programopt">--prefix</b> option has traditionally been used
274to install additional packages in separate locations on Windows.
275
276<P>
277<div class="verbatim"><pre>
278python setup.py install --prefix="\Temp\Python"
279</pre></div>
280
281<P>
282to install modules to the
283<span class="file">&#92;Temp&#92;Python</span> directory on the
284current drive.
285
286<P>
287The installation base is defined by the <b class="programopt">--prefix</b> option;
288the <b class="programopt">--exec-prefix</b> option is not supported under Windows.
289Files are installed as follows:
290<div class="center"><table class="realtable">
291 <thead>
292 <tr>
293 <th class="left" >Type of file</th>
294 <th class="left" >Installation Directory</th>
295 <th class="left" >Override option</th>
296 </tr>
297 </thead>
298 <tbody>
299 <tr><td class="left" valign="baseline">pure module distribution</td>
300 <td class="left" ><span class="du-filevar">prefix</span><span class="file"></span></td>
301 <td class="left" ><b class="programopt">--install-purelib</b></td></tr>
302 <tr><td class="left" valign="baseline">non-pure module distribution</td>
303 <td class="left" ><span class="du-filevar">prefix</span><span class="file"></span></td>
304 <td class="left" ><b class="programopt">--install-platlib</b></td></tr>
305 <tr><td class="left" valign="baseline">scripts</td>
306 <td class="left" ><span class="du-filevar">prefix</span><span class="file">&#92;Scripts</span></td>
307 <td class="left" ><b class="programopt">--install-scripts</b></td></tr>
308 <tr><td class="left" valign="baseline">data</td>
309 <td class="left" ><span class="du-filevar">prefix</span><span class="file">&#92;Data</span></td>
310 <td class="left" ><b class="programopt">--install-data</b></td></tr></tbody>
311</table></div>
312
313<P>
314
315<DIV CLASS="navigation">
316<div class='online-navigation'>
317<p></p><hr />
318<table align="center" width="100%" cellpadding="0" cellspacing="2">
319<tr>
320<td class='online-navigation'><a rel="prev" title="2 Standard Build and"
321 href="standard-install.html"><img src='../icons/previous.png'
322 border='0' height='32' alt='Previous Page' width='32' /></A></td>
323<td class='online-navigation'><a rel="parent" title="Installing Python Modules"
324 href="inst.html"><img src='../icons/up.png'
325 border='0' height='32' alt='Up One Level' width='32' /></A></td>
326<td class='online-navigation'><a rel="next" title="4 Custom Installation"
327 href="search-path.html"><img src='../icons/next.png'
328 border='0' height='32' alt='Next Page' width='32' /></A></td>
329<td align="center" width="100%">Installing Python Modules</td>
330<td class='online-navigation'><img src='../icons/blank.png'
331 border='0' height='32' alt='' width='32' /></td>
332<td class='online-navigation'><img src='../icons/blank.png'
333 border='0' height='32' alt='' width='32' /></td>
334<td class='online-navigation'><img src='../icons/blank.png'
335 border='0' height='32' alt='' width='32' /></td>
336</tr></table>
337<div class='online-navigation'>
338<b class="navlabel">Previous:</b>
339<a class="sectref" rel="prev" href="standard-install.html">2 Standard Build and</A>
340<b class="navlabel">Up:</b>
341<a class="sectref" rel="parent" href="inst.html">Installing Python Modules</A>
342<b class="navlabel">Next:</b>
343<a class="sectref" rel="next" href="search-path.html">4 Custom Installation</A>
344</div>
345</div>
346<hr />
347<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
348</DIV>
349<!--End of Navigation Panel-->
350<ADDRESS>
351See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
352</ADDRESS>
353</BODY>
354</HTML>