~dkuhlman/python-training-materials/Materials

« back to all changes in this revision

Viewing changes to python-3.5.2-docs-html/library/sysconfig.html

  • Committer: Dave Kuhlman
  • Date: 2017-04-15 16:24:56 UTC
  • Revision ID: dkuhlman@davekuhlman.org-20170415162456-iav9vozzg4iwqwv3
Updated docs

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 
2
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
3
 
 
4
 
 
5
<html xmlns="http://www.w3.org/1999/xhtml">
 
6
  <head>
 
7
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
8
    
 
9
    <title>29.2. sysconfig — Provide access to Python’s configuration information &mdash; Python 3.5.2 documentation</title>
 
10
    
 
11
    <link rel="stylesheet" href="../_static/pydoctheme.css" type="text/css" />
 
12
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
 
13
    
 
14
    <script type="text/javascript">
 
15
      var DOCUMENTATION_OPTIONS = {
 
16
        URL_ROOT:    '../',
 
17
        VERSION:     '3.5.2',
 
18
        COLLAPSE_INDEX: false,
 
19
        FILE_SUFFIX: '.html',
 
20
        HAS_SOURCE:  true
 
21
      };
 
22
    </script>
 
23
    <script type="text/javascript" src="../_static/jquery.js"></script>
 
24
    <script type="text/javascript" src="../_static/underscore.js"></script>
 
25
    <script type="text/javascript" src="../_static/doctools.js"></script>
 
26
    <script type="text/javascript" src="../_static/sidebar.js"></script>
 
27
    <link rel="search" type="application/opensearchdescription+xml"
 
28
          title="Search within Python 3.5.2 documentation"
 
29
          href="../_static/opensearch.xml"/>
 
30
    <link rel="author" title="About these documents" href="../about.html" />
 
31
    <link rel="copyright" title="Copyright" href="../copyright.html" />
 
32
    <link rel="top" title="Python 3.5.2 documentation" href="../contents.html" />
 
33
    <link rel="up" title="29. Python Runtime Services" href="python.html" />
 
34
    <link rel="next" title="29.3. builtins — Built-in objects" href="builtins.html" />
 
35
    <link rel="prev" title="29.1. sys — System-specific parameters and functions" href="sys.html" />
 
36
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
 
37
    
 
38
    <script type="text/javascript" src="../_static/copybutton.js"></script>
 
39
    <script type="text/javascript" src="../_static/version_switch.js"></script>
 
40
    
 
41
    
 
42
 
 
43
 
 
44
  </head>
 
45
  <body role="document">  
 
46
    <div class="related" role="navigation" aria-label="related navigation">
 
47
      <h3>Navigation</h3>
 
48
      <ul>
 
49
        <li class="right" style="margin-right: 10px">
 
50
          <a href="../genindex.html" title="General Index"
 
51
             accesskey="I">index</a></li>
 
52
        <li class="right" >
 
53
          <a href="../py-modindex.html" title="Python Module Index"
 
54
             >modules</a> |</li>
 
55
        <li class="right" >
 
56
          <a href="builtins.html" title="29.3. builtins — Built-in objects"
 
57
             accesskey="N">next</a> |</li>
 
58
        <li class="right" >
 
59
          <a href="sys.html" title="29.1. sys — System-specific parameters and functions"
 
60
             accesskey="P">previous</a> |</li>
 
61
        <li><img src="../_static/py.png" alt=""
 
62
                 style="vertical-align: middle; margin-top: -1px"/></li>
 
63
        <li><a href="https://www.python.org/">Python</a> &raquo;</li>
 
64
        <li>
 
65
          <span class="version_switcher_placeholder">3.5.2</span>
 
66
          <a href="../index.html">Documentation </a> &raquo;
 
67
        </li>
 
68
 
 
69
          <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &raquo;</li>
 
70
          <li class="nav-item nav-item-2"><a href="python.html" accesskey="U">29. Python Runtime Services</a> &raquo;</li>
 
71
    <li class="right">
 
72
        
 
73
 
 
74
    <div class="inline-search" style="display: none" role="search">
 
75
        <form class="inline-search" action="../search.html" method="get">
 
76
          <input placeholder="Quick search" type="text" name="q" />
 
77
          <input type="submit" value="Go" />
 
78
          <input type="hidden" name="check_keywords" value="yes" />
 
79
          <input type="hidden" name="area" value="default" />
 
80
        </form>
 
81
    </div>
 
82
    <script type="text/javascript">$('.inline-search').show(0);</script>
 
83
         |
 
84
    </li>
 
85
 
 
86
      </ul>
 
87
    </div>    
 
88
 
 
89
    <div class="document">
 
90
      <div class="documentwrapper">
 
91
        <div class="bodywrapper">
 
92
          <div class="body" role="main">
 
93
            
 
94
  <div class="section" id="module-sysconfig">
 
95
<span id="sysconfig-provide-access-to-python-s-configuration-information"></span><h1>29.2. <a class="reference internal" href="#module-sysconfig" title="sysconfig: Python's configuration information"><code class="xref py py-mod docutils literal"><span class="pre">sysconfig</span></code></a> &#8212; Provide access to Python&#8217;s configuration information<a class="headerlink" href="#module-sysconfig" title="Permalink to this headline">¶</a></h1>
 
96
<div class="versionadded">
 
97
<p><span class="versionmodified">New in version 3.2.</span></p>
 
98
</div>
 
99
<p><strong>Source code:</strong> <a class="reference external" href="https://hg.python.org/cpython/file/3.5/Lib/sysconfig.py">Lib/sysconfig.py</a></p>
 
100
<hr class="docutils" id="index-0" />
 
101
<p>The <a class="reference internal" href="#module-sysconfig" title="sysconfig: Python's configuration information"><code class="xref py py-mod docutils literal"><span class="pre">sysconfig</span></code></a> module provides access to Python&#8217;s configuration
 
102
information like the list of installation paths and the configuration variables
 
103
relevant for the current platform.</p>
 
104
<div class="section" id="configuration-variables">
 
105
<h2>29.2.1. Configuration variables<a class="headerlink" href="#configuration-variables" title="Permalink to this headline">¶</a></h2>
 
106
<p>A Python distribution contains a <code class="file docutils literal"><span class="pre">Makefile</span></code> and a <code class="file docutils literal"><span class="pre">pyconfig.h</span></code>
 
107
header file that are necessary to build both the Python binary itself and
 
108
third-party C extensions compiled using <a class="reference internal" href="distutils.html#module-distutils" title="distutils: Support for building and installing Python modules into an existing Python installation."><code class="xref py py-mod docutils literal"><span class="pre">distutils</span></code></a>.</p>
 
109
<p><a class="reference internal" href="#module-sysconfig" title="sysconfig: Python's configuration information"><code class="xref py py-mod docutils literal"><span class="pre">sysconfig</span></code></a> puts all variables found in these files in a dictionary that
 
110
can be accessed using <a class="reference internal" href="#sysconfig.get_config_vars" title="sysconfig.get_config_vars"><code class="xref py py-func docutils literal"><span class="pre">get_config_vars()</span></code></a> or <a class="reference internal" href="#sysconfig.get_config_var" title="sysconfig.get_config_var"><code class="xref py py-func docutils literal"><span class="pre">get_config_var()</span></code></a>.</p>
 
111
<p>Notice that on Windows, it&#8217;s a much smaller set.</p>
 
112
<dl class="function">
 
113
<dt id="sysconfig.get_config_vars">
 
114
<code class="descclassname">sysconfig.</code><code class="descname">get_config_vars</code><span class="sig-paren">(</span><em>*args</em><span class="sig-paren">)</span><a class="headerlink" href="#sysconfig.get_config_vars" title="Permalink to this definition">¶</a></dt>
 
115
<dd><p>With no arguments, return a dictionary of all configuration variables
 
116
relevant for the current platform.</p>
 
117
<p>With arguments, return a list of values that result from looking up each
 
118
argument in the configuration variable dictionary.</p>
 
119
<p>For each argument, if the value is not found, return <code class="docutils literal"><span class="pre">None</span></code>.</p>
 
120
</dd></dl>
 
121
 
 
122
<dl class="function">
 
123
<dt id="sysconfig.get_config_var">
 
124
<code class="descclassname">sysconfig.</code><code class="descname">get_config_var</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#sysconfig.get_config_var" title="Permalink to this definition">¶</a></dt>
 
125
<dd><p>Return the value of a single variable <em>name</em>. Equivalent to
 
126
<code class="docutils literal"><span class="pre">get_config_vars().get(name)</span></code>.</p>
 
127
<p>If <em>name</em> is not found, return <code class="docutils literal"><span class="pre">None</span></code>.</p>
 
128
</dd></dl>
 
129
 
 
130
<p>Example of usage:</p>
 
131
<div class="highlight-python3"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">sysconfig</span>
 
132
<span class="gp">&gt;&gt;&gt; </span><span class="n">sysconfig</span><span class="o">.</span><span class="n">get_config_var</span><span class="p">(</span><span class="s1">&#39;Py_ENABLE_SHARED&#39;</span><span class="p">)</span>
 
133
<span class="go">0</span>
 
134
<span class="gp">&gt;&gt;&gt; </span><span class="n">sysconfig</span><span class="o">.</span><span class="n">get_config_var</span><span class="p">(</span><span class="s1">&#39;LIBDIR&#39;</span><span class="p">)</span>
 
135
<span class="go">&#39;/usr/local/lib&#39;</span>
 
136
<span class="gp">&gt;&gt;&gt; </span><span class="n">sysconfig</span><span class="o">.</span><span class="n">get_config_vars</span><span class="p">(</span><span class="s1">&#39;AR&#39;</span><span class="p">,</span> <span class="s1">&#39;CXX&#39;</span><span class="p">)</span>
 
137
<span class="go">[&#39;ar&#39;, &#39;g++&#39;]</span>
 
138
</pre></div>
 
139
</div>
 
140
</div>
 
141
<div class="section" id="installation-paths">
 
142
<h2>29.2.2. Installation paths<a class="headerlink" href="#installation-paths" title="Permalink to this headline">¶</a></h2>
 
143
<p>Python uses an installation scheme that differs depending on the platform and on
 
144
the installation options.  These schemes are stored in <a class="reference internal" href="#module-sysconfig" title="sysconfig: Python's configuration information"><code class="xref py py-mod docutils literal"><span class="pre">sysconfig</span></code></a> under
 
145
unique identifiers based on the value returned by <a class="reference internal" href="os.html#os.name" title="os.name"><code class="xref py py-const docutils literal"><span class="pre">os.name</span></code></a>.</p>
 
146
<p>Every new component that is installed using <a class="reference internal" href="distutils.html#module-distutils" title="distutils: Support for building and installing Python modules into an existing Python installation."><code class="xref py py-mod docutils literal"><span class="pre">distutils</span></code></a> or a
 
147
Distutils-based system will follow the same scheme to copy its file in the right
 
148
places.</p>
 
149
<p>Python currently supports seven schemes:</p>
 
150
<ul class="simple">
 
151
<li><em>posix_prefix</em>: scheme for Posix platforms like Linux or Mac OS X.  This is
 
152
the default scheme used when Python or a component is installed.</li>
 
153
<li><em>posix_home</em>: scheme for Posix platforms used when a <em>home</em> option is used
 
154
upon installation.  This scheme is used when a component is installed through
 
155
Distutils with a specific home prefix.</li>
 
156
<li><em>posix_user</em>: scheme for Posix platforms used when a component is installed
 
157
through Distutils and the <em>user</em> option is used.  This scheme defines paths
 
158
located under the user home directory.</li>
 
159
<li><em>nt</em>: scheme for NT platforms like Windows.</li>
 
160
<li><em>nt_user</em>: scheme for NT platforms, when the <em>user</em> option is used.</li>
 
161
</ul>
 
162
<p>Each scheme is itself composed of a series of paths and each path has a unique
 
163
identifier.  Python currently uses eight paths:</p>
 
164
<ul class="simple">
 
165
<li><em>stdlib</em>: directory containing the standard Python library files that are not
 
166
platform-specific.</li>
 
167
<li><em>platstdlib</em>: directory containing the standard Python library files that are
 
168
platform-specific.</li>
 
169
<li><em>platlib</em>: directory for site-specific, platform-specific files.</li>
 
170
<li><em>purelib</em>: directory for site-specific, non-platform-specific files.</li>
 
171
<li><em>include</em>: directory for non-platform-specific header files.</li>
 
172
<li><em>platinclude</em>: directory for platform-specific header files.</li>
 
173
<li><em>scripts</em>: directory for script files.</li>
 
174
<li><em>data</em>: directory for data files.</li>
 
175
</ul>
 
176
<p><a class="reference internal" href="#module-sysconfig" title="sysconfig: Python's configuration information"><code class="xref py py-mod docutils literal"><span class="pre">sysconfig</span></code></a> provides some functions to determine these paths.</p>
 
177
<dl class="function">
 
178
<dt id="sysconfig.get_scheme_names">
 
179
<code class="descclassname">sysconfig.</code><code class="descname">get_scheme_names</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#sysconfig.get_scheme_names" title="Permalink to this definition">¶</a></dt>
 
180
<dd><p>Return a tuple containing all schemes currently supported in
 
181
<a class="reference internal" href="#module-sysconfig" title="sysconfig: Python's configuration information"><code class="xref py py-mod docutils literal"><span class="pre">sysconfig</span></code></a>.</p>
 
182
</dd></dl>
 
183
 
 
184
<dl class="function">
 
185
<dt id="sysconfig.get_path_names">
 
186
<code class="descclassname">sysconfig.</code><code class="descname">get_path_names</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#sysconfig.get_path_names" title="Permalink to this definition">¶</a></dt>
 
187
<dd><p>Return a tuple containing all path names currently supported in
 
188
<a class="reference internal" href="#module-sysconfig" title="sysconfig: Python's configuration information"><code class="xref py py-mod docutils literal"><span class="pre">sysconfig</span></code></a>.</p>
 
189
</dd></dl>
 
190
 
 
191
<dl class="function">
 
192
<dt id="sysconfig.get_path">
 
193
<code class="descclassname">sysconfig.</code><code class="descname">get_path</code><span class="sig-paren">(</span><em>name</em><span class="optional">[</span>, <em>scheme</em><span class="optional">[</span>, <em>vars</em><span class="optional">[</span>, <em>expand</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#sysconfig.get_path" title="Permalink to this definition">¶</a></dt>
 
194
<dd><p>Return an installation path corresponding to the path <em>name</em>, from the
 
195
install scheme named <em>scheme</em>.</p>
 
196
<p><em>name</em> has to be a value from the list returned by <a class="reference internal" href="#sysconfig.get_path_names" title="sysconfig.get_path_names"><code class="xref py py-func docutils literal"><span class="pre">get_path_names()</span></code></a>.</p>
 
197
<p><a class="reference internal" href="#module-sysconfig" title="sysconfig: Python's configuration information"><code class="xref py py-mod docutils literal"><span class="pre">sysconfig</span></code></a> stores installation paths corresponding to each path name,
 
198
for each platform, with variables to be expanded.  For instance the <em>stdlib</em>
 
199
path for the <em>nt</em> scheme is: <code class="docutils literal"><span class="pre">{base}/Lib</span></code>.</p>
 
200
<p><a class="reference internal" href="#sysconfig.get_path" title="sysconfig.get_path"><code class="xref py py-func docutils literal"><span class="pre">get_path()</span></code></a> will use the variables returned by <a class="reference internal" href="#sysconfig.get_config_vars" title="sysconfig.get_config_vars"><code class="xref py py-func docutils literal"><span class="pre">get_config_vars()</span></code></a>
 
201
to expand the path.  All variables have default values for each platform so
 
202
one may call this function and get the default value.</p>
 
203
<p>If <em>scheme</em> is provided, it must be a value from the list returned by
 
204
<a class="reference internal" href="#sysconfig.get_scheme_names" title="sysconfig.get_scheme_names"><code class="xref py py-func docutils literal"><span class="pre">get_scheme_names()</span></code></a>.  Otherwise, the default scheme for the current
 
205
platform is used.</p>
 
206
<p>If <em>vars</em> is provided, it must be a dictionary of variables that will update
 
207
the dictionary return by <a class="reference internal" href="#sysconfig.get_config_vars" title="sysconfig.get_config_vars"><code class="xref py py-func docutils literal"><span class="pre">get_config_vars()</span></code></a>.</p>
 
208
<p>If <em>expand</em> is set to <code class="docutils literal"><span class="pre">False</span></code>, the path will not be expanded using the
 
209
variables.</p>
 
210
<p>If <em>name</em> is not found, return <code class="docutils literal"><span class="pre">None</span></code>.</p>
 
211
</dd></dl>
 
212
 
 
213
<dl class="function">
 
214
<dt id="sysconfig.get_paths">
 
215
<code class="descclassname">sysconfig.</code><code class="descname">get_paths</code><span class="sig-paren">(</span><span class="optional">[</span><em>scheme</em><span class="optional">[</span>, <em>vars</em><span class="optional">[</span>, <em>expand</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#sysconfig.get_paths" title="Permalink to this definition">¶</a></dt>
 
216
<dd><p>Return a dictionary containing all installation paths corresponding to an
 
217
installation scheme. See <a class="reference internal" href="#sysconfig.get_path" title="sysconfig.get_path"><code class="xref py py-func docutils literal"><span class="pre">get_path()</span></code></a> for more information.</p>
 
218
<p>If <em>scheme</em> is not provided, will use the default scheme for the current
 
219
platform.</p>
 
220
<p>If <em>vars</em> is provided, it must be a dictionary of variables that will
 
221
update the dictionary used to expand the paths.</p>
 
222
<p>If <em>expand</em> is set to false, the paths will not be expanded.</p>
 
223
<p>If <em>scheme</em> is not an existing scheme, <a class="reference internal" href="#sysconfig.get_paths" title="sysconfig.get_paths"><code class="xref py py-func docutils literal"><span class="pre">get_paths()</span></code></a> will raise a
 
224
<a class="reference internal" href="exceptions.html#KeyError" title="KeyError"><code class="xref py py-exc docutils literal"><span class="pre">KeyError</span></code></a>.</p>
 
225
</dd></dl>
 
226
 
 
227
</div>
 
228
<div class="section" id="other-functions">
 
229
<h2>29.2.3. Other functions<a class="headerlink" href="#other-functions" title="Permalink to this headline">¶</a></h2>
 
230
<dl class="function">
 
231
<dt id="sysconfig.get_python_version">
 
232
<code class="descclassname">sysconfig.</code><code class="descname">get_python_version</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#sysconfig.get_python_version" title="Permalink to this definition">¶</a></dt>
 
233
<dd><p>Return the <code class="docutils literal"><span class="pre">MAJOR.MINOR</span></code> Python version number as a string.  Similar to
 
234
<code class="docutils literal"><span class="pre">sys.version[:3]</span></code>.</p>
 
235
</dd></dl>
 
236
 
 
237
<dl class="function">
 
238
<dt id="sysconfig.get_platform">
 
239
<code class="descclassname">sysconfig.</code><code class="descname">get_platform</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#sysconfig.get_platform" title="Permalink to this definition">¶</a></dt>
 
240
<dd><p>Return a string that identifies the current platform.</p>
 
241
<p>This is used mainly to distinguish platform-specific build directories and
 
242
platform-specific built distributions.  Typically includes the OS name and
 
243
version and the architecture (as supplied by <a class="reference internal" href="os.html#os.uname" title="os.uname"><code class="xref py py-func docutils literal"><span class="pre">os.uname()</span></code></a>), although the
 
244
exact information included depends on the OS; e.g. for IRIX the architecture
 
245
isn&#8217;t particularly important (IRIX only runs on SGI hardware), but for Linux
 
246
the kernel version isn&#8217;t particularly important.</p>
 
247
<p>Examples of returned values:</p>
 
248
<ul class="simple">
 
249
<li>linux-i586</li>
 
250
<li>linux-alpha (?)</li>
 
251
<li>solaris-2.6-sun4u</li>
 
252
<li>irix-5.3</li>
 
253
<li>irix64-6.2</li>
 
254
</ul>
 
255
<p>Windows will return one of:</p>
 
256
<ul class="simple">
 
257
<li>win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc)</li>
 
258
<li>win-ia64 (64bit Windows on Itanium)</li>
 
259
<li>win32 (all others - specifically, sys.platform is returned)</li>
 
260
</ul>
 
261
<p>Mac OS X can return:</p>
 
262
<ul class="simple">
 
263
<li>macosx-10.6-ppc</li>
 
264
<li>macosx-10.4-ppc64</li>
 
265
<li>macosx-10.3-i386</li>
 
266
<li>macosx-10.4-fat</li>
 
267
</ul>
 
268
<p>For other non-POSIX platforms, currently just returns <a class="reference internal" href="sys.html#sys.platform" title="sys.platform"><code class="xref py py-data docutils literal"><span class="pre">sys.platform</span></code></a>.</p>
 
269
</dd></dl>
 
270
 
 
271
<dl class="function">
 
272
<dt id="sysconfig.is_python_build">
 
273
<code class="descclassname">sysconfig.</code><code class="descname">is_python_build</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#sysconfig.is_python_build" title="Permalink to this definition">¶</a></dt>
 
274
<dd><p>Return <code class="docutils literal"><span class="pre">True</span></code> if the running Python interpreter was built from source and
 
275
is being run from its built location, and not from a location resulting from
 
276
e.g. running <code class="docutils literal"><span class="pre">make</span> <span class="pre">install</span></code> or installing via a binary installer.</p>
 
277
</dd></dl>
 
278
 
 
279
<dl class="function">
 
280
<dt id="sysconfig.parse_config_h">
 
281
<code class="descclassname">sysconfig.</code><code class="descname">parse_config_h</code><span class="sig-paren">(</span><em>fp</em><span class="optional">[</span>, <em>vars</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#sysconfig.parse_config_h" title="Permalink to this definition">¶</a></dt>
 
282
<dd><p>Parse a <code class="file docutils literal"><span class="pre">config.h</span></code>-style file.</p>
 
283
<p><em>fp</em> is a file-like object pointing to the <code class="file docutils literal"><span class="pre">config.h</span></code>-like file.</p>
 
284
<p>A dictionary containing name/value pairs is returned.  If an optional
 
285
dictionary is passed in as the second argument, it is used instead of a new
 
286
dictionary, and updated with the values read in the file.</p>
 
287
</dd></dl>
 
288
 
 
289
<dl class="function">
 
290
<dt id="sysconfig.get_config_h_filename">
 
291
<code class="descclassname">sysconfig.</code><code class="descname">get_config_h_filename</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#sysconfig.get_config_h_filename" title="Permalink to this definition">¶</a></dt>
 
292
<dd><p>Return the path of <code class="file docutils literal"><span class="pre">pyconfig.h</span></code>.</p>
 
293
</dd></dl>
 
294
 
 
295
<dl class="function">
 
296
<dt id="sysconfig.get_makefile_filename">
 
297
<code class="descclassname">sysconfig.</code><code class="descname">get_makefile_filename</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#sysconfig.get_makefile_filename" title="Permalink to this definition">¶</a></dt>
 
298
<dd><p>Return the path of <code class="file docutils literal"><span class="pre">Makefile</span></code>.</p>
 
299
</dd></dl>
 
300
 
 
301
</div>
 
302
<div class="section" id="using-sysconfig-as-a-script">
 
303
<h2>29.2.4. Using <a class="reference internal" href="#module-sysconfig" title="sysconfig: Python's configuration information"><code class="xref py py-mod docutils literal"><span class="pre">sysconfig</span></code></a> as a script<a class="headerlink" href="#using-sysconfig-as-a-script" title="Permalink to this headline">¶</a></h2>
 
304
<p>You can use <a class="reference internal" href="#module-sysconfig" title="sysconfig: Python's configuration information"><code class="xref py py-mod docutils literal"><span class="pre">sysconfig</span></code></a> as a script with Python&#8217;s <em>-m</em> option:</p>
 
305
<div class="highlight-shell-session"><div class="highlight"><pre><span></span><span class="gp">$</span> python -m sysconfig
 
306
<span class="go">Platform: &quot;macosx-10.4-i386&quot;</span>
 
307
<span class="go">Python version: &quot;3.2&quot;</span>
 
308
<span class="go">Current installation scheme: &quot;posix_prefix&quot;</span>
 
309
 
 
310
<span class="go">Paths:</span>
 
311
<span class="go">        data = &quot;/usr/local&quot;</span>
 
312
<span class="go">        include = &quot;/Users/tarek/Dev/svn.python.org/py3k/Include&quot;</span>
 
313
<span class="go">        platinclude = &quot;.&quot;</span>
 
314
<span class="go">        platlib = &quot;/usr/local/lib/python3.2/site-packages&quot;</span>
 
315
<span class="go">        platstdlib = &quot;/usr/local/lib/python3.2&quot;</span>
 
316
<span class="go">        purelib = &quot;/usr/local/lib/python3.2/site-packages&quot;</span>
 
317
<span class="go">        scripts = &quot;/usr/local/bin&quot;</span>
 
318
<span class="go">        stdlib = &quot;/usr/local/lib/python3.2&quot;</span>
 
319
 
 
320
<span class="go">Variables:</span>
 
321
<span class="go">        AC_APPLE_UNIVERSAL_BUILD = &quot;0&quot;</span>
 
322
<span class="go">        AIX_GENUINE_CPLUSPLUS = &quot;0&quot;</span>
 
323
<span class="go">        AR = &quot;ar&quot;</span>
 
324
<span class="go">        ARFLAGS = &quot;rc&quot;</span>
 
325
<span class="go">        ASDLGEN = &quot;./Parser/asdl_c.py&quot;</span>
 
326
<span class="go">        ...</span>
 
327
</pre></div>
 
328
</div>
 
329
<p>This call will print in the standard output the information returned by
 
330
<a class="reference internal" href="#sysconfig.get_platform" title="sysconfig.get_platform"><code class="xref py py-func docutils literal"><span class="pre">get_platform()</span></code></a>, <a class="reference internal" href="#sysconfig.get_python_version" title="sysconfig.get_python_version"><code class="xref py py-func docutils literal"><span class="pre">get_python_version()</span></code></a>, <a class="reference internal" href="#sysconfig.get_path" title="sysconfig.get_path"><code class="xref py py-func docutils literal"><span class="pre">get_path()</span></code></a> and
 
331
<a class="reference internal" href="#sysconfig.get_config_vars" title="sysconfig.get_config_vars"><code class="xref py py-func docutils literal"><span class="pre">get_config_vars()</span></code></a>.</p>
 
332
</div>
 
333
</div>
 
334
 
 
335
 
 
336
          </div>
 
337
        </div>
 
338
      </div>
 
339
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
 
340
        <div class="sphinxsidebarwrapper">
 
341
  <h3><a href="../contents.html">Table Of Contents</a></h3>
 
342
  <ul>
 
343
<li><a class="reference internal" href="#">29.2. <code class="docutils literal"><span class="pre">sysconfig</span></code> &#8212; Provide access to Python&#8217;s configuration information</a><ul>
 
344
<li><a class="reference internal" href="#configuration-variables">29.2.1. Configuration variables</a></li>
 
345
<li><a class="reference internal" href="#installation-paths">29.2.2. Installation paths</a></li>
 
346
<li><a class="reference internal" href="#other-functions">29.2.3. Other functions</a></li>
 
347
<li><a class="reference internal" href="#using-sysconfig-as-a-script">29.2.4. Using <code class="docutils literal"><span class="pre">sysconfig</span></code> as a script</a></li>
 
348
</ul>
 
349
</li>
 
350
</ul>
 
351
 
 
352
  <h4>Previous topic</h4>
 
353
  <p class="topless"><a href="sys.html"
 
354
                        title="previous chapter">29.1. <code class="docutils literal"><span class="pre">sys</span></code> &#8212; System-specific parameters and functions</a></p>
 
355
  <h4>Next topic</h4>
 
356
  <p class="topless"><a href="builtins.html"
 
357
                        title="next chapter">29.3. <code class="docutils literal"><span class="pre">builtins</span></code> &#8212; Built-in objects</a></p>
 
358
  <div role="note" aria-label="source link">
 
359
    <h3>This Page</h3>
 
360
    <ul class="this-page-menu">
 
361
      <li><a href="../bugs.html">Report a Bug</a></li>
 
362
      <li><a href="../_sources/library/sysconfig.txt"
 
363
            rel="nofollow">Show Source</a></li>
 
364
    </ul>
 
365
  </div>
 
366
        </div>
 
367
      </div>
 
368
      <div class="clearer"></div>
 
369
    </div>  
 
370
    <div class="related" role="navigation" aria-label="related navigation">
 
371
      <h3>Navigation</h3>
 
372
      <ul>
 
373
        <li class="right" style="margin-right: 10px">
 
374
          <a href="../genindex.html" title="General Index"
 
375
             >index</a></li>
 
376
        <li class="right" >
 
377
          <a href="../py-modindex.html" title="Python Module Index"
 
378
             >modules</a> |</li>
 
379
        <li class="right" >
 
380
          <a href="builtins.html" title="29.3. builtins — Built-in objects"
 
381
             >next</a> |</li>
 
382
        <li class="right" >
 
383
          <a href="sys.html" title="29.1. sys — System-specific parameters and functions"
 
384
             >previous</a> |</li>
 
385
        <li><img src="../_static/py.png" alt=""
 
386
                 style="vertical-align: middle; margin-top: -1px"/></li>
 
387
        <li><a href="https://www.python.org/">Python</a> &raquo;</li>
 
388
        <li>
 
389
          <span class="version_switcher_placeholder">3.5.2</span>
 
390
          <a href="../index.html">Documentation </a> &raquo;
 
391
        </li>
 
392
 
 
393
          <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &raquo;</li>
 
394
          <li class="nav-item nav-item-2"><a href="python.html" >29. Python Runtime Services</a> &raquo;</li>
 
395
    <li class="right">
 
396
        
 
397
 
 
398
    <div class="inline-search" style="display: none" role="search">
 
399
        <form class="inline-search" action="../search.html" method="get">
 
400
          <input placeholder="Quick search" type="text" name="q" />
 
401
          <input type="submit" value="Go" />
 
402
          <input type="hidden" name="check_keywords" value="yes" />
 
403
          <input type="hidden" name="area" value="default" />
 
404
        </form>
 
405
    </div>
 
406
    <script type="text/javascript">$('.inline-search').show(0);</script>
 
407
         |
 
408
    </li>
 
409
 
 
410
      </ul>
 
411
    </div>  
 
412
    <div class="footer">
 
413
    &copy; <a href="../copyright.html">Copyright</a> 2001-2016, Python Software Foundation.
 
414
    <br />
 
415
    The Python Software Foundation is a non-profit corporation.
 
416
    <a href="https://www.python.org/psf/donations/">Please donate.</a>
 
417
    <br />
 
418
    Last updated on Oct 19, 2016.
 
419
    <a href="../bugs.html">Found a bug</a>?
 
420
    <br />
 
421
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.3.3.
 
422
    </div>
 
423
 
 
424
  </body>
 
425
</html>
 
 
b'\\ No newline at end of file'