parthtamu/rag-code-assistant
0
1<!DOCTYPE html>2 3<html lang="en" data-content_root="../">4 <head>5 <meta charset="utf-8" />6 <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />7<meta property="og:title" content="sysconfig — Provide access to Python’s configuration information" />8<meta property="og:type" content="website" />9<meta property="og:url" content="https://docs.python.org/3/library/sysconfig.html" />10<meta property="og:site_name" content="Python documentation" />11<meta property="og:description" content="Source code: Lib/sysconfig The sysconfig module provides access to Python’s configuration information like the list of installation paths and the configuration variables relevant for the current pl..." />12<meta property="og:image:width" content="1146" />13<meta property="og:image:height" content="600" />14<meta property="og:image" content="https://docs.python.org/3.15/_images/social_previews/summary_library_sysconfig_af98a715.png" />15<meta property="og:image:alt" content="Source code: Lib/sysconfig The sysconfig module provides access to Python’s configuration information like the list of installation paths and the configuration variables relevant for the current pl..." />16<meta name="description" content="Source code: Lib/sysconfig The sysconfig module provides access to Python’s configuration information like the list of installation paths and the configuration variables relevant for the current pl..." />17<meta name="twitter:card" content="summary_large_image" />18<meta name="theme-color" content="#3776ab">19 20 <title>sysconfig — Provide access to Python’s configuration information — Python 3.15.0a6 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0">21 22 <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=b86133f3" />23 <link rel="stylesheet" type="text/css" href="../_static/classic.css?v=234b1a7c" />24 <link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?v=89a2f22a" />25 <link rel="stylesheet" type="text/css" href="../_static/profiling-sampling-visualization.css?v=0c2600ae" />26 <link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css?v=5349f25f" />27 28 <script src="../_static/documentation_options.js?v=6b7c9ff5"></script>29 <script src="../_static/doctools.js?v=9bcbadda"></script>30 <script src="../_static/sphinx_highlight.js?v=dc90522c"></script>31 <script src="../_static/profiling-sampling-visualization.js?v=9811ed04"></script>32 33 <script src="../_static/sidebar.js"></script>34 35 <link rel="search" type="application/opensearchdescription+xml"36 title="Search within Python 3.15.0a6 documentation"37 href="../_static/opensearch.xml"/>38 <link rel="author" title="About these documents" href="../about.html" />39 <link rel="index" title="Index" href="../genindex.html" />40 <link rel="search" title="Search" href="../search.html" />41 <link rel="copyright" title="Copyright" href="../copyright.html" />42 <link rel="next" title="builtins — Built-in objects" href="builtins.html" />43 <link rel="prev" title="sys.monitoring — Execution event monitoring" href="sys.monitoring.html" />44 45 46 <script defer file-types="bz2,epub,zip" data-domain="docs.python.org" src="https://analytics.python.org/js/script.file-downloads.outbound-links.js"></script>47 48 <link rel="canonical" href="https://docs.python.org/3/library/sysconfig.html">49 50 51 52 53 <style>54 @media only screen {55 table.full-width-table {56 width: 100%;57 }58 }59 </style>60<link rel="stylesheet" href="../_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">61 <link rel="shortcut icon" type="image/png" href="../_static/py.svg">62 <script type="text/javascript" src="../_static/copybutton.js"></script>63 <script type="text/javascript" src="../_static/menu.js"></script>64 <script type="text/javascript" src="../_static/search-focus.js"></script>65 <script type="text/javascript" src="../_static/themetoggle.js"></script> 66 <script type="text/javascript" src="../_static/rtd_switcher.js"></script>67 <meta name="readthedocs-addons-api-version" content="1">68 69 </head>70<body>71<div class="mobile-nav">72 <input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"73 aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu">74 <nav class="nav-content" role="navigation">75 <label for="menuToggler" class="toggler__label">76 <span></span>77 </label>78 <span class="nav-items-wrapper">79 <a href="https://www.python.org/" class="nav-logo">80 <img src="../_static/py.svg" alt="Python logo">81 </a>82 <span class="version_switcher_placeholder"></span>83 <form role="search" class="search" action="../search.html" method="get">84 <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">85 <path fill-rule="nonzero" fill="currentColor" d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path>86 </svg>87 <input placeholder="Quick search" aria-label="Quick search" type="search" name="q">88 <input type="submit" value="Go">89 </form>90 </span>91 </nav>92 <div class="menu-wrapper">93 <nav class="menu" role="navigation" aria-label="main navigation">94 <div class="language_switcher_placeholder"></div>95 96<label class="theme-selector-label">97 Theme98 <select class="theme-selector" oninput="activateTheme(this.value)">99 <option value="auto" selected>Auto</option>100 <option value="light">Light</option>101 <option value="dark">Dark</option>102 </select>103</label>104 <div>105 <h3><a href="../contents.html">Table of Contents</a></h3>106 <ul>107<li><a class="reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sysconfig</span></code> — Provide access to Python’s configuration information</a><ul>108<li><a class="reference internal" href="#configuration-variables">Configuration variables</a></li>109<li><a class="reference internal" href="#installation-paths">Installation paths</a></li>110<li><a class="reference internal" href="#user-scheme">User scheme</a><ul>111<li><a class="reference internal" href="#posix-user"><code class="docutils literal notranslate"><span class="pre">posix_user</span></code></a></li>112<li><a class="reference internal" href="#nt-user"><code class="docutils literal notranslate"><span class="pre">nt_user</span></code></a></li>113<li><a class="reference internal" href="#osx-framework-user"><code class="docutils literal notranslate"><span class="pre">osx_framework_user</span></code></a></li>114</ul>115</li>116<li><a class="reference internal" href="#home-scheme">Home scheme</a><ul>117<li><a class="reference internal" href="#posix-home"><code class="docutils literal notranslate"><span class="pre">posix_home</span></code></a></li>118</ul>119</li>120<li><a class="reference internal" href="#prefix-scheme">Prefix scheme</a><ul>121<li><a class="reference internal" href="#posix-prefix"><code class="docutils literal notranslate"><span class="pre">posix_prefix</span></code></a></li>122<li><a class="reference internal" href="#nt"><code class="docutils literal notranslate"><span class="pre">nt</span></code></a></li>123</ul>124</li>125<li><a class="reference internal" href="#installation-path-functions">Installation path functions</a></li>126<li><a class="reference internal" href="#other-functions">Other functions</a></li>127<li><a class="reference internal" href="#command-line-usage">Command-line usage</a></li>128</ul>129</li>130</ul>131 132 </div>133 <div>134 <h4>Previous topic</h4>135 <p class="topless"><a href="sys.monitoring.html"136 title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sys.monitoring</span></code> — Execution event monitoring</a></p>137 </div>138 <div>139 <h4>Next topic</h4>140 <p class="topless"><a href="builtins.html"141 title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">builtins</span></code> — Built-in objects</a></p>142 </div>143 <script>144 document.addEventListener('DOMContentLoaded', () => {145 const title = document.querySelector('meta[property="og:title"]').content;146 const elements = document.querySelectorAll('.improvepage');147 const pageurl = window.location.href.split('?')[0];148 elements.forEach(element => {149 const url = new URL(element.href.split('?')[0].replace("-nojs", ""));150 url.searchParams.set('pagetitle', title);151 url.searchParams.set('pageurl', pageurl);152 url.searchParams.set('pagesource', "library/sysconfig.rst");153 element.href = url.toString();154 });155 });156 </script>157 <div role="note" aria-label="source link">158 <h3>This page</h3>159 <ul class="this-page-menu">160 <li><a href="../bugs.html">Report a bug</a></li>161 <li><a class="improvepage" href="../improve-page-nojs.html">Improve this page</a></li>162 <li>163 <a href="https://github.com/python/cpython/blob/main/Doc/library/sysconfig.rst?plain=1"164 rel="nofollow">Show source165 </a>166 </li>167 168 </ul>169 </div>170 </nav>171 </div>172</div>173 174 175 <div class="related" role="navigation" aria-label="Related">176 <h3>Navigation</h3>177 <ul>178 <li class="right" style="margin-right: 10px">179 <a href="../genindex.html" title="General Index"180 accesskey="I">index</a></li>181 <li class="right" >182 <a href="../py-modindex.html" title="Python Module Index"183 >modules</a> |</li>184 <li class="right" >185 <a href="builtins.html" title="builtins — Built-in objects"186 accesskey="N">next</a> |</li>187 <li class="right" >188 <a href="sys.monitoring.html" title="sys.monitoring — Execution event monitoring"189 accesskey="P">previous</a> |</li>190 191 <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"></li>192 <li><a href="https://www.python.org/">Python</a> »</li>193 <li class="switchers">194 <div class="language_switcher_placeholder"></div>195 <div class="version_switcher_placeholder"></div>196 </li>197 <li>198 199 </li>200 <li id="cpython-language-and-version">201 <a href="../index.html">3.15.0a6 Documentation</a> »202 </li>203 204 <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> »</li>205 <li class="nav-item nav-item-2"><a href="python.html" accesskey="U">Python Runtime Services</a> »</li>206 <li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">sysconfig</span></code> — Provide access to Python’s configuration information</a></li>207 <li class="right">208 209 210 <div class="inline-search" role="search">211 <form class="inline-search" action="../search.html" method="get">212 <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box">213 <input type="submit" value="Go">214 </form>215 </div>216 |217 </li>218 <li class="right">219<label class="theme-selector-label">220 Theme221 <select class="theme-selector" oninput="activateTheme(this.value)">222 <option value="auto" selected>Auto</option>223 <option value="light">Light</option>224 <option value="dark">Dark</option>225 </select>226</label> |</li>227 228 </ul>229 </div> 230 231 <div class="document">232 <div class="documentwrapper">233 <div class="bodywrapper">234 <div class="body" role="main">235 236 <section id="module-sysconfig">237<span id="sysconfig-provide-access-to-python-s-configuration-information"></span><h1><code class="xref py py-mod docutils literal notranslate"><span class="pre">sysconfig</span></code> — Provide access to Python’s configuration information<a class="headerlink" href="#module-sysconfig" title="Link to this heading">¶</a></h1>238<div class="versionadded">239<p><span class="versionmodified added">Added in version 3.2.</span></p>240</div>241<p><strong>Source code:</strong> <a class="extlink-source reference external" href="https://github.com/python/cpython/tree/main/Lib/sysconfig">Lib/sysconfig</a></p>242<hr class="docutils" id="index-0" />243<p>The <code class="xref py py-mod docutils literal notranslate"><span class="pre">sysconfig</span></code> module provides access to Python’s configuration244information like the list of installation paths and the configuration variables245relevant for the current platform.</p>246<section id="configuration-variables">247<h2>Configuration variables<a class="headerlink" href="#configuration-variables" title="Link to this heading">¶</a></h2>248<p>A Python distribution contains a <code class="file docutils literal notranslate"><span class="pre">Makefile</span></code> and a <code class="file docutils literal notranslate"><span class="pre">pyconfig.h</span></code>249header file that are necessary to build both the Python binary itself and250third-party C extensions compiled using <code class="docutils literal notranslate"><span class="pre">setuptools</span></code>.</p>251<p><code class="xref py py-mod docutils literal notranslate"><span class="pre">sysconfig</span></code> puts all variables found in these files in a dictionary that252can 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 notranslate"><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 notranslate"><span class="pre">get_config_var()</span></code></a>.</p>253<p>Notice that on Windows, it’s a much smaller set.</p>254<dl class="py function">255<dt class="sig sig-object py" id="sysconfig.get_config_vars">256<span class="sig-prename descclassname"><span class="pre">sysconfig.</span></span><span class="sig-name descname"><span class="pre">get_config_vars</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#sysconfig.get_config_vars" title="Link to this definition">¶</a></dt>257<dd><p>With no arguments, return a dictionary of all configuration variables258relevant for the current platform.</p>259<p>With arguments, return a list of values that result from looking up each260argument in the configuration variable dictionary.</p>261<p>For each argument, if the value is not found, return <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>262</dd></dl>263 264<dl class="py function">265<dt class="sig sig-object py" id="sysconfig.get_config_var">266<span class="sig-prename descclassname"><span class="pre">sysconfig.</span></span><span class="sig-name descname"><span class="pre">get_config_var</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#sysconfig.get_config_var" title="Link to this definition">¶</a></dt>267<dd><p>Return the value of a single variable <em>name</em>. Equivalent to268<code class="docutils literal notranslate"><span class="pre">get_config_vars().get(name)</span></code>.</p>269<p>If <em>name</em> is not found, return <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>270</dd></dl>271 272<p>Example of usage:</p>273<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span><span class="w"> </span><span class="nn">sysconfig</span>274<span class="gp">>>> </span><span class="n">sysconfig</span><span class="o">.</span><span class="n">get_config_var</span><span class="p">(</span><span class="s1">'Py_ENABLE_SHARED'</span><span class="p">)</span>275<span class="go">0</span>276<span class="gp">>>> </span><span class="n">sysconfig</span><span class="o">.</span><span class="n">get_config_var</span><span class="p">(</span><span class="s1">'LIBDIR'</span><span class="p">)</span>277<span class="go">'/usr/local/lib'</span>278<span class="gp">>>> </span><span class="n">sysconfig</span><span class="o">.</span><span class="n">get_config_vars</span><span class="p">(</span><span class="s1">'AR'</span><span class="p">,</span> <span class="s1">'CXX'</span><span class="p">)</span>279<span class="go">['ar', 'g++']</span>280</pre></div>281</div>282</section>283<section id="installation-paths">284<span id="id1"></span><h2>Installation paths<a class="headerlink" href="#installation-paths" title="Link to this heading">¶</a></h2>285<p>Python uses an installation scheme that differs depending on the platform and on286the installation options. These schemes are stored in <code class="xref py py-mod docutils literal notranslate"><span class="pre">sysconfig</span></code> under287unique 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 notranslate"><span class="pre">os.name</span></code></a>.288The schemes are used by package installers to determine where to copy files to.</p>289<p>Python currently supports nine schemes:</p>290<ul class="simple">291<li><p><em>posix_prefix</em>: scheme for POSIX platforms like Linux or macOS. This is292the default scheme used when Python or a component is installed.</p></li>293<li><p><em>posix_home</em>: scheme for POSIX platforms, when the <em>home</em> option is used.294This scheme defines paths located under a specific home prefix.</p></li>295<li><p><em>posix_user</em>: scheme for POSIX platforms, when the <em>user</em> option is used.296This scheme defines paths located under the user’s home directory297(<a class="reference internal" href="site.html#site.USER_BASE" title="site.USER_BASE"><code class="xref py py-const docutils literal notranslate"><span class="pre">site.USER_BASE</span></code></a>).</p></li>298<li><p><em>posix_venv</em>: scheme for <a class="reference internal" href="venv.html#module-venv" title="venv: Creation of virtual environments."><code class="xref py py-mod docutils literal notranslate"><span class="pre">Python</span> <span class="pre">virtual</span> <span class="pre">environments</span></code></a> on POSIX299platforms; by default it is the same as <em>posix_prefix</em>.</p></li>300<li><p><em>nt</em>: scheme for Windows.301This is the default scheme used when Python or a component is installed.</p></li>302<li><p><em>nt_user</em>: scheme for Windows, when the <em>user</em> option is used.</p></li>303<li><p><em>nt_venv</em>: scheme for <a class="reference internal" href="venv.html#module-venv" title="venv: Creation of virtual environments."><code class="xref py py-mod docutils literal notranslate"><span class="pre">Python</span> <span class="pre">virtual</span> <span class="pre">environments</span></code></a> on Windows;304by default it is the same as <em>nt</em>.</p></li>305<li><p><em>venv</em>: a scheme with values from either <em>posix_venv</em> or <em>nt_venv</em> depending306on the platform Python runs on.</p></li>307<li><p><em>osx_framework_user</em>: scheme for macOS, when the <em>user</em> option is used.</p></li>308</ul>309<p>Each scheme is itself composed of a series of paths and each path has a unique310identifier. Python currently uses eight paths:</p>311<ul class="simple">312<li><p><em>stdlib</em>: directory containing the standard Python library files that are not313platform-specific.</p></li>314<li><p><em>platstdlib</em>: directory containing the standard Python library files that are315platform-specific.</p></li>316<li><p><em>platlib</em>: directory for site-specific, platform-specific files.</p></li>317<li><p><em>purelib</em>: directory for site-specific, non-platform-specific files (‘pure’ Python).</p></li>318<li><p><em>include</em>: directory for non-platform-specific header files for319the Python C-API.</p></li>320<li><p><em>platinclude</em>: directory for platform-specific header files for321the Python C-API.</p></li>322<li><p><em>scripts</em>: directory for script files.</p></li>323<li><p><em>data</em>: directory for data files.</p></li>324</ul>325</section>326<section id="user-scheme">327<span id="sysconfig-user-scheme"></span><h2>User scheme<a class="headerlink" href="#user-scheme" title="Link to this heading">¶</a></h2>328<p>This scheme is designed to be the most convenient solution for users that don’t329have write permission to the global site-packages directory or don’t want to330install into it.</p>331<p>Files will be installed into subdirectories of <a class="reference internal" href="site.html#site.USER_BASE" title="site.USER_BASE"><code class="xref py py-const docutils literal notranslate"><span class="pre">site.USER_BASE</span></code></a> (written332as <code class="file docutils literal notranslate"><em><span class="pre">userbase</span></em></code> hereafter). This scheme installs pure Python modules and333extension modules in the same location (also known as <a class="reference internal" href="site.html#site.USER_SITE" title="site.USER_SITE"><code class="xref py py-const docutils literal notranslate"><span class="pre">site.USER_SITE</span></code></a>).</p>334<section id="posix-user">335<h3><code class="docutils literal notranslate"><span class="pre">posix_user</span></code><a class="headerlink" href="#posix-user" title="Link to this heading">¶</a></h3>336<table class="docutils align-default">337<thead>338<tr class="row-odd"><th class="head"><p>Path</p></th>339<th class="head"><p>Installation directory</p></th>340</tr>341</thead>342<tbody>343<tr class="row-even"><td><p><em>stdlib</em></p></td>344<td><p><code class="file docutils literal notranslate"><em><span class="pre">userbase</span></em><span class="pre">/lib/python</span><em><span class="pre">X.Y</span></em></code></p></td>345</tr>346<tr class="row-odd"><td><p><em>platstdlib</em></p></td>347<td><p><code class="file docutils literal notranslate"><em><span class="pre">userbase</span></em><span class="pre">/lib/python</span><em><span class="pre">X.Y</span></em></code></p></td>348</tr>349<tr class="row-even"><td><p><em>platlib</em></p></td>350<td><p><code class="file docutils literal notranslate"><em><span class="pre">userbase</span></em><span class="pre">/lib/python</span><em><span class="pre">X.Y</span></em><span class="pre">/site-packages</span></code></p></td>351</tr>352<tr class="row-odd"><td><p><em>purelib</em></p></td>353<td><p><code class="file docutils literal notranslate"><em><span class="pre">userbase</span></em><span class="pre">/lib/python</span><em><span class="pre">X.Y</span></em><span class="pre">/site-packages</span></code></p></td>354</tr>355<tr class="row-even"><td><p><em>include</em></p></td>356<td><p><code class="file docutils literal notranslate"><em><span class="pre">userbase</span></em><span class="pre">/include/python</span><em><span class="pre">X.Y</span></em></code></p></td>357</tr>358<tr class="row-odd"><td><p><em>scripts</em></p></td>359<td><p><code class="file docutils literal notranslate"><em><span class="pre">userbase</span></em><span class="pre">/bin</span></code></p></td>360</tr>361<tr class="row-even"><td><p><em>data</em></p></td>362<td><p><code class="file docutils literal notranslate"><em><span class="pre">userbase</span></em></code></p></td>363</tr>364</tbody>365</table>366</section>367<section id="nt-user">368<h3><code class="docutils literal notranslate"><span class="pre">nt_user</span></code><a class="headerlink" href="#nt-user" title="Link to this heading">¶</a></h3>369<table class="docutils align-default">370<thead>371<tr class="row-odd"><th class="head"><p>Path</p></th>372<th class="head"><p>Installation directory</p></th>373</tr>374</thead>375<tbody>376<tr class="row-even"><td><p><em>stdlib</em></p></td>377<td><p><code class="file docutils literal notranslate"><em><span class="pre">userbase</span></em><span class="pre">\Python</span><em><span class="pre">XY</span></em></code></p></td>378</tr>379<tr class="row-odd"><td><p><em>platstdlib</em></p></td>380<td><p><code class="file docutils literal notranslate"><em><span class="pre">userbase</span></em><span class="pre">\Python</span><em><span class="pre">XY</span></em></code></p></td>381</tr>382<tr class="row-even"><td><p><em>platlib</em></p></td>383<td><p><code class="file docutils literal notranslate"><em><span class="pre">userbase</span></em><span class="pre">\Python</span><em><span class="pre">XY</span></em><span class="pre">\site-packages</span></code></p></td>384</tr>385<tr class="row-odd"><td><p><em>purelib</em></p></td>386<td><p><code class="file docutils literal notranslate"><em><span class="pre">userbase</span></em><span class="pre">\Python</span><em><span class="pre">XY</span></em><span class="pre">\site-packages</span></code></p></td>387</tr>388<tr class="row-even"><td><p><em>include</em></p></td>389<td><p><code class="file docutils literal notranslate"><em><span class="pre">userbase</span></em><span class="pre">\Python</span><em><span class="pre">XY</span></em><span class="pre">\Include</span></code></p></td>390</tr>391<tr class="row-odd"><td><p><em>scripts</em></p></td>392<td><p><code class="file docutils literal notranslate"><em><span class="pre">userbase</span></em><span class="pre">\Python</span><em><span class="pre">XY</span></em><span class="pre">\Scripts</span></code></p></td>393</tr>394<tr class="row-even"><td><p><em>data</em></p></td>395<td><p><code class="file docutils literal notranslate"><em><span class="pre">userbase</span></em></code></p></td>396</tr>397</tbody>398</table>399</section>400<section id="osx-framework-user">401<h3><code class="docutils literal notranslate"><span class="pre">osx_framework_user</span></code><a class="headerlink" href="#osx-framework-user" title="Link to this heading">¶</a></h3>402<table class="docutils align-default">403<thead>404<tr class="row-odd"><th class="head"><p>Path</p></th>405<th class="head"><p>Installation directory</p></th>406</tr>407</thead>408<tbody>409<tr class="row-even"><td><p><em>stdlib</em></p></td>410<td><p><code class="file docutils literal notranslate"><em><span class="pre">userbase</span></em><span class="pre">/lib/python</span></code></p></td>411</tr>412<tr class="row-odd"><td><p><em>platstdlib</em></p></td>413<td><p><code class="file docutils literal notranslate"><em><span class="pre">userbase</span></em><span class="pre">/lib/python</span></code></p></td>414</tr>415<tr class="row-even"><td><p><em>platlib</em></p></td>416<td><p><code class="file docutils literal notranslate"><em><span class="pre">userbase</span></em><span class="pre">/lib/python/site-packages</span></code></p></td>417</tr>418<tr class="row-odd"><td><p><em>purelib</em></p></td>419<td><p><code class="file docutils literal notranslate"><em><span class="pre">userbase</span></em><span class="pre">/lib/python/site-packages</span></code></p></td>420</tr>421<tr class="row-even"><td><p><em>include</em></p></td>422<td><p><code class="file docutils literal notranslate"><em><span class="pre">userbase</span></em><span class="pre">/include/python</span><em><span class="pre">X.Y</span></em></code></p></td>423</tr>424<tr class="row-odd"><td><p><em>scripts</em></p></td>425<td><p><code class="file docutils literal notranslate"><em><span class="pre">userbase</span></em><span class="pre">/bin</span></code></p></td>426</tr>427<tr class="row-even"><td><p><em>data</em></p></td>428<td><p><code class="file docutils literal notranslate"><em><span class="pre">userbase</span></em></code></p></td>429</tr>430</tbody>431</table>432</section>433</section>434<section id="home-scheme">435<span id="sysconfig-home-scheme"></span><h2>Home scheme<a class="headerlink" href="#home-scheme" title="Link to this heading">¶</a></h2>436<p>The idea behind the “home scheme” is that you build and maintain a personal437stash of Python modules. This scheme’s name is derived from the idea of a438“home” directory on Unix, since it’s not unusual for a Unix user to make their439home directory have a layout similar to <code class="file docutils literal notranslate"><span class="pre">/usr/</span></code> or <code class="file docutils literal notranslate"><span class="pre">/usr/local/</span></code>.440This scheme can be used by anyone, regardless of the operating system they441are installing for.</p>442<section id="posix-home">443<h3><code class="docutils literal notranslate"><span class="pre">posix_home</span></code><a class="headerlink" href="#posix-home" title="Link to this heading">¶</a></h3>444<table class="docutils align-default">445<thead>446<tr class="row-odd"><th class="head"><p>Path</p></th>447<th class="head"><p>Installation directory</p></th>448</tr>449</thead>450<tbody>451<tr class="row-even"><td><p><em>stdlib</em></p></td>452<td><p><code class="file docutils literal notranslate"><em><span class="pre">home</span></em><span class="pre">/lib/python</span></code></p></td>453</tr>454<tr class="row-odd"><td><p><em>platstdlib</em></p></td>455<td><p><code class="file docutils literal notranslate"><em><span class="pre">home</span></em><span class="pre">/lib/python</span></code></p></td>456</tr>457<tr class="row-even"><td><p><em>platlib</em></p></td>458<td><p><code class="file docutils literal notranslate"><em><span class="pre">home</span></em><span class="pre">/lib/python</span></code></p></td>459</tr>460<tr class="row-odd"><td><p><em>purelib</em></p></td>461<td><p><code class="file docutils literal notranslate"><em><span class="pre">home</span></em><span class="pre">/lib/python</span></code></p></td>462</tr>463<tr class="row-even"><td><p><em>include</em></p></td>464<td><p><code class="file docutils literal notranslate"><em><span class="pre">home</span></em><span class="pre">/include/python</span></code></p></td>465</tr>466<tr class="row-odd"><td><p><em>platinclude</em></p></td>467<td><p><code class="file docutils literal notranslate"><em><span class="pre">home</span></em><span class="pre">/include/python</span></code></p></td>468</tr>469<tr class="row-even"><td><p><em>scripts</em></p></td>470<td><p><code class="file docutils literal notranslate"><em><span class="pre">home</span></em><span class="pre">/bin</span></code></p></td>471</tr>472<tr class="row-odd"><td><p><em>data</em></p></td>473<td><p><code class="file docutils literal notranslate"><em><span class="pre">home</span></em></code></p></td>474</tr>475</tbody>476</table>477</section>478</section>479<section id="prefix-scheme">480<span id="sysconfig-prefix-scheme"></span><h2>Prefix scheme<a class="headerlink" href="#prefix-scheme" title="Link to this heading">¶</a></h2>481<p>The “prefix scheme” is useful when you wish to use one Python installation to482perform the build/install (i.e., to run the setup script), but install modules483into the third-party module directory of a different Python installation (or484something that looks like a different Python installation). If this sounds a485trifle unusual, it is—that’s why the user and home schemes come before. However,486there are at least two known cases where the prefix scheme will be useful.</p>487<p>First, consider that many Linux distributions put Python in <code class="file docutils literal notranslate"><span class="pre">/usr</span></code>, rather488than the more traditional <code class="file docutils literal notranslate"><span class="pre">/usr/local</span></code>. This is entirely appropriate,489since in those cases Python is part of “the system” rather than a local add-on.490However, if you are installing Python modules from source, you probably want491them to go in <code class="file docutils literal notranslate"><span class="pre">/usr/local/lib/python2.</span><em><span class="pre">X</span></em></code> rather than492<code class="file docutils literal notranslate"><span class="pre">/usr/lib/python2.</span><em><span class="pre">X</span></em></code>.</p>493<p>Another possibility is a network filesystem where the name used to write to a494remote directory is different from the name used to read it: for example, the495Python interpreter accessed as <code class="file docutils literal notranslate"><span class="pre">/usr/local/bin/python</span></code> might search for496modules in <code class="file docutils literal notranslate"><span class="pre">/usr/local/lib/python2.</span><em><span class="pre">X</span></em></code>, but those modules would have to497be installed to, say, <code class="file docutils literal notranslate"><span class="pre">/mnt/</span><em><span class="pre">@server</span></em><span class="pre">/export/lib/python2.</span><em><span class="pre">X</span></em></code>.</p>498<section id="posix-prefix">499<h3><code class="docutils literal notranslate"><span class="pre">posix_prefix</span></code><a class="headerlink" href="#posix-prefix" title="Link to this heading">¶</a></h3>500<table class="docutils align-default">501<thead>502<tr class="row-odd"><th class="head"><p>Path</p></th>503<th class="head"><p>Installation directory</p></th>504</tr>505</thead>506<tbody>507<tr class="row-even"><td><p><em>stdlib</em></p></td>508<td><p><code class="file docutils literal notranslate"><em><span class="pre">prefix</span></em><span class="pre">/lib/python</span><em><span class="pre">X.Y</span></em></code></p></td>509</tr>510<tr class="row-odd"><td><p><em>platstdlib</em></p></td>511<td><p><code class="file docutils literal notranslate"><em><span class="pre">prefix</span></em><span class="pre">/lib/python</span><em><span class="pre">X.Y</span></em></code></p></td>512</tr>513<tr class="row-even"><td><p><em>platlib</em></p></td>514<td><p><code class="file docutils literal notranslate"><em><span class="pre">prefix</span></em><span class="pre">/lib/python</span><em><span class="pre">X.Y</span></em><span class="pre">/site-packages</span></code></p></td>515</tr>516<tr class="row-odd"><td><p><em>purelib</em></p></td>517<td><p><code class="file docutils literal notranslate"><em><span class="pre">prefix</span></em><span class="pre">/lib/python</span><em><span class="pre">X.Y</span></em><span class="pre">/site-packages</span></code></p></td>518</tr>519<tr class="row-even"><td><p><em>include</em></p></td>520<td><p><code class="file docutils literal notranslate"><em><span class="pre">prefix</span></em><span class="pre">/include/python</span><em><span class="pre">X.Y</span></em></code></p></td>521</tr>522<tr class="row-odd"><td><p><em>platinclude</em></p></td>523<td><p><code class="file docutils literal notranslate"><em><span class="pre">prefix</span></em><span class="pre">/include/python</span><em><span class="pre">X.Y</span></em></code></p></td>524</tr>525<tr class="row-even"><td><p><em>scripts</em></p></td>526<td><p><code class="file docutils literal notranslate"><em><span class="pre">prefix</span></em><span class="pre">/bin</span></code></p></td>527</tr>528<tr class="row-odd"><td><p><em>data</em></p></td>529<td><p><code class="file docutils literal notranslate"><em><span class="pre">prefix</span></em></code></p></td>530</tr>531</tbody>532</table>533</section>534<section id="nt">535<h3><code class="docutils literal notranslate"><span class="pre">nt</span></code><a class="headerlink" href="#nt" title="Link to this heading">¶</a></h3>536<table class="docutils align-default">537<thead>538<tr class="row-odd"><th class="head"><p>Path</p></th>539<th class="head"><p>Installation directory</p></th>540</tr>541</thead>542<tbody>543<tr class="row-even"><td><p><em>stdlib</em></p></td>544<td><p><code class="file docutils literal notranslate"><em><span class="pre">prefix</span></em><span class="pre">\Lib</span></code></p></td>545</tr>546<tr class="row-odd"><td><p><em>platstdlib</em></p></td>547<td><p><code class="file docutils literal notranslate"><em><span class="pre">prefix</span></em><span class="pre">\Lib</span></code></p></td>548</tr>549<tr class="row-even"><td><p><em>platlib</em></p></td>550<td><p><code class="file docutils literal notranslate"><em><span class="pre">prefix</span></em><span class="pre">\Lib\site-packages</span></code></p></td>551</tr>552<tr class="row-odd"><td><p><em>purelib</em></p></td>553<td><p><code class="file docutils literal notranslate"><em><span class="pre">prefix</span></em><span class="pre">\Lib\site-packages</span></code></p></td>554</tr>555<tr class="row-even"><td><p><em>include</em></p></td>556<td><p><code class="file docutils literal notranslate"><em><span class="pre">prefix</span></em><span class="pre">\Include</span></code></p></td>557</tr>558<tr class="row-odd"><td><p><em>platinclude</em></p></td>559<td><p><code class="file docutils literal notranslate"><em><span class="pre">prefix</span></em><span class="pre">\Include</span></code></p></td>560</tr>561<tr class="row-even"><td><p><em>scripts</em></p></td>562<td><p><code class="file docutils literal notranslate"><em><span class="pre">prefix</span></em><span class="pre">\Scripts</span></code></p></td>563</tr>564<tr class="row-odd"><td><p><em>data</em></p></td>565<td><p><code class="file docutils literal notranslate"><em><span class="pre">prefix</span></em></code></p></td>566</tr>567</tbody>568</table>569</section>570</section>571<section id="installation-path-functions">572<h2>Installation path functions<a class="headerlink" href="#installation-path-functions" title="Link to this heading">¶</a></h2>573<p><code class="xref py py-mod docutils literal notranslate"><span class="pre">sysconfig</span></code> provides some functions to determine these installation paths.</p>574<dl class="py function">575<dt class="sig sig-object py" id="sysconfig.get_scheme_names">576<span class="sig-prename descclassname"><span class="pre">sysconfig.</span></span><span class="sig-name descname"><span class="pre">get_scheme_names</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#sysconfig.get_scheme_names" title="Link to this definition">¶</a></dt>577<dd><p>Return a tuple containing all schemes currently supported in578<code class="xref py py-mod docutils literal notranslate"><span class="pre">sysconfig</span></code>.</p>579</dd></dl>580 581<dl class="py function">582<dt class="sig sig-object py" id="sysconfig.get_default_scheme">583<span class="sig-prename descclassname"><span class="pre">sysconfig.</span></span><span class="sig-name descname"><span class="pre">get_default_scheme</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#sysconfig.get_default_scheme" title="Link to this definition">¶</a></dt>584<dd><p>Return the default scheme name for the current platform.</p>585<div class="versionadded">586<p><span class="versionmodified added">Added in version 3.10: </span>This function was previously named <code class="docutils literal notranslate"><span class="pre">_get_default_scheme()</span></code> and587considered an implementation detail.</p>588</div>589<div class="versionchanged">590<p><span class="versionmodified changed">Changed in version 3.11: </span>When Python runs from a virtual environment,591the <em>venv</em> scheme is returned.</p>592</div>593</dd></dl>594 595<dl class="py function">596<dt class="sig sig-object py" id="sysconfig.get_preferred_scheme">597<span class="sig-prename descclassname"><span class="pre">sysconfig.</span></span><span class="sig-name descname"><span class="pre">get_preferred_scheme</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">key</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#sysconfig.get_preferred_scheme" title="Link to this definition">¶</a></dt>598<dd><p>Return a preferred scheme name for an installation layout specified by <em>key</em>.</p>599<p><em>key</em> must be either <code class="docutils literal notranslate"><span class="pre">"prefix"</span></code>, <code class="docutils literal notranslate"><span class="pre">"home"</span></code>, or <code class="docutils literal notranslate"><span class="pre">"user"</span></code>.</p>600<p>The return value is a scheme name listed in <a class="reference internal" href="#sysconfig.get_scheme_names" title="sysconfig.get_scheme_names"><code class="xref py py-func docutils literal notranslate"><span class="pre">get_scheme_names()</span></code></a>. It601can be passed to <code class="xref py py-mod docutils literal notranslate"><span class="pre">sysconfig</span></code> functions that take a <em>scheme</em> argument,602such as <a class="reference internal" href="#sysconfig.get_paths" title="sysconfig.get_paths"><code class="xref py py-func docutils literal notranslate"><span class="pre">get_paths()</span></code></a>.</p>603<div class="versionadded">604<p><span class="versionmodified added">Added in version 3.10.</span></p>605</div>606<div class="versionchanged">607<p><span class="versionmodified changed">Changed in version 3.11: </span>When Python runs from a virtual environment and <code class="docutils literal notranslate"><span class="pre">key="prefix"</span></code>,608the <em>venv</em> scheme is returned.</p>609</div>610</dd></dl>611 612<dl class="py function">613<dt class="sig sig-object py" id="sysconfig._get_preferred_schemes">614<span class="sig-prename descclassname"><span class="pre">sysconfig.</span></span><span class="sig-name descname"><span class="pre">_get_preferred_schemes</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#sysconfig._get_preferred_schemes" title="Link to this definition">¶</a></dt>615<dd><p>Return a dict containing preferred scheme names on the current platform.616Python implementers and redistributors may add their preferred schemes to617the <code class="docutils literal notranslate"><span class="pre">_INSTALL_SCHEMES</span></code> module-level global value, and modify this function618to return those scheme names, to e.g. provide different schemes for system619and language package managers to use, so packages installed by either do not620mix with those by the other.</p>621<p>End users should not use this function, but <a class="reference internal" href="#sysconfig.get_default_scheme" title="sysconfig.get_default_scheme"><code class="xref py py-func docutils literal notranslate"><span class="pre">get_default_scheme()</span></code></a> and622<a class="reference internal" href="#sysconfig.get_preferred_scheme" title="sysconfig.get_preferred_scheme"><code class="xref py py-func docutils literal notranslate"><span class="pre">get_preferred_scheme()</span></code></a> instead.</p>623<div class="versionadded">624<p><span class="versionmodified added">Added in version 3.10.</span></p>625</div>626</dd></dl>627 628<dl class="py function">629<dt class="sig sig-object py" id="sysconfig.get_path_names">630<span class="sig-prename descclassname"><span class="pre">sysconfig.</span></span><span class="sig-name descname"><span class="pre">get_path_names</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#sysconfig.get_path_names" title="Link to this definition">¶</a></dt>631<dd><p>Return a tuple containing all path names currently supported in632<code class="xref py py-mod docutils literal notranslate"><span class="pre">sysconfig</span></code>.</p>633</dd></dl>634 635<dl class="py function">636<dt class="sig sig-object py" id="sysconfig.get_path">637<span class="sig-prename descclassname"><span class="pre">sysconfig.</span></span><span class="sig-name descname"><span class="pre">get_path</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em><span class="optional">[</span>, <em class="sig-param"><span class="n"><span class="pre">scheme</span></span></em><span class="optional">[</span>, <em class="sig-param"><span class="n"><span class="pre">vars</span></span></em><span class="optional">[</span>, <em class="sig-param"><span class="n"><span class="pre">expand</span></span></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="Link to this definition">¶</a></dt>638<dd><p>Return an installation path corresponding to the path <em>name</em>, from the639install scheme named <em>scheme</em>.</p>640<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 notranslate"><span class="pre">get_path_names()</span></code></a>.</p>641<p><code class="xref py py-mod docutils literal notranslate"><span class="pre">sysconfig</span></code> stores installation paths corresponding to each path name,642for each platform, with variables to be expanded. For instance the <em>stdlib</em>643path for the <em>nt</em> scheme is: <code class="docutils literal notranslate"><span class="pre">{base}/Lib</span></code>.</p>644<p><code class="xref py py-func docutils literal notranslate"><span class="pre">get_path()</span></code> 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 notranslate"><span class="pre">get_config_vars()</span></code></a>645to expand the path. All variables have default values for each platform so646one may call this function and get the default value.</p>647<p>If <em>scheme</em> is provided, it must be a value from the list returned by648<a class="reference internal" href="#sysconfig.get_scheme_names" title="sysconfig.get_scheme_names"><code class="xref py py-func docutils literal notranslate"><span class="pre">get_scheme_names()</span></code></a>. Otherwise, the default scheme for the current649platform is used.</p>650<p>If <em>vars</em> is provided, it must be a dictionary of variables that will update651the dictionary returned by <a class="reference internal" href="#sysconfig.get_config_vars" title="sysconfig.get_config_vars"><code class="xref py py-func docutils literal notranslate"><span class="pre">get_config_vars()</span></code></a>.</p>652<p>If <em>expand</em> is set to <code class="docutils literal notranslate"><span class="pre">False</span></code>, the path will not be expanded using the653variables.</p>654<p>If <em>name</em> is not found, raise a <a class="reference internal" href="exceptions.html#KeyError" title="KeyError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">KeyError</span></code></a>.</p>655</dd></dl>656 657<dl class="py function">658<dt class="sig sig-object py" id="sysconfig.get_paths">659<span class="sig-prename descclassname"><span class="pre">sysconfig.</span></span><span class="sig-name descname"><span class="pre">get_paths</span></span><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param"><span class="n"><span class="pre">scheme</span></span></em><span class="optional">[</span>, <em class="sig-param"><span class="n"><span class="pre">vars</span></span></em><span class="optional">[</span>, <em class="sig-param"><span class="n"><span class="pre">expand</span></span></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="Link to this definition">¶</a></dt>660<dd><p>Return a dictionary containing all installation paths corresponding to an661installation scheme. See <a class="reference internal" href="#sysconfig.get_path" title="sysconfig.get_path"><code class="xref py py-func docutils literal notranslate"><span class="pre">get_path()</span></code></a> for more information.</p>662<p>If <em>scheme</em> is not provided, will use the default scheme for the current663platform.</p>664<p>If <em>vars</em> is provided, it must be a dictionary of variables that will665update the dictionary used to expand the paths.</p>666<p>If <em>expand</em> is set to false, the paths will not be expanded.</p>667<p>If <em>scheme</em> is not an existing scheme, <code class="xref py py-func docutils literal notranslate"><span class="pre">get_paths()</span></code> will raise a668<a class="reference internal" href="exceptions.html#KeyError" title="KeyError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">KeyError</span></code></a>.</p>669</dd></dl>670 671</section>672<section id="other-functions">673<h2>Other functions<a class="headerlink" href="#other-functions" title="Link to this heading">¶</a></h2>674<dl class="py function">675<dt class="sig sig-object py" id="sysconfig.get_python_version">676<span class="sig-prename descclassname"><span class="pre">sysconfig.</span></span><span class="sig-name descname"><span class="pre">get_python_version</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#sysconfig.get_python_version" title="Link to this definition">¶</a></dt>677<dd><p>Return the <code class="docutils literal notranslate"><span class="pre">MAJOR.MINOR</span></code> Python version number as a string. Similar to678<code class="docutils literal notranslate"><span class="pre">'%d.%d'</span> <span class="pre">%</span> <span class="pre">sys.version_info[:2]</span></code>.</p>679</dd></dl>680 681<dl class="py function">682<dt class="sig sig-object py" id="sysconfig.get_platform">683<span class="sig-prename descclassname"><span class="pre">sysconfig.</span></span><span class="sig-name descname"><span class="pre">get_platform</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#sysconfig.get_platform" title="Link to this definition">¶</a></dt>684<dd><p>Return a string that identifies the current platform.</p>685<p>This is used mainly to distinguish platform-specific build directories and686platform-specific built distributions. Typically includes the OS name and687version 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 notranslate"><span class="pre">os.uname()</span></code></a>), although the688exact information included depends on the OS; e.g., on Linux, the kernel689version isn’t particularly important.</p>690<p>Examples of returned values:</p>691<ul class="simple">692<li><p>linux-x86_64</p></li>693<li><p>linux-aarch64</p></li>694<li><p>solaris-2.6-sun4u</p></li>695</ul>696<p>Windows:</p>697<ul class="simple">698<li><p>win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T)</p></li>699<li><p>win-arm64 (64-bit Windows on ARM64, aka AArch64)</p></li>700<li><p>win32 (all others - specifically, sys.platform is returned)</p></li>701</ul>702<p>POSIX based OS:</p>703<ul class="simple">704<li><p>linux-x86_64</p></li>705<li><p>macosx-15.5-arm64</p></li>706<li><p>macosx-26.0-universal2 (macOS on Apple Silicon or Intel)</p></li>707<li><p>android-24-arm64_v8a</p></li>708</ul>709<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 notranslate"><span class="pre">sys.platform</span></code></a>.</p>710</dd></dl>711 712<dl class="py function">713<dt class="sig sig-object py" id="sysconfig.is_python_build">714<span class="sig-prename descclassname"><span class="pre">sysconfig.</span></span><span class="sig-name descname"><span class="pre">is_python_build</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#sysconfig.is_python_build" title="Link to this definition">¶</a></dt>715<dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if the running Python interpreter was built from source and716is being run from its built location, and not from a location resulting from717e.g. running <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">install</span></code> or installing via a binary installer.</p>718</dd></dl>719 720<dl class="py function">721<dt class="sig sig-object py" id="sysconfig.parse_config_h">722<span class="sig-prename descclassname"><span class="pre">sysconfig.</span></span><span class="sig-name descname"><span class="pre">parse_config_h</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">fp</span></span></em><span class="optional">[</span>, <em class="sig-param"><span class="n"><span class="pre">vars</span></span></em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#sysconfig.parse_config_h" title="Link to this definition">¶</a></dt>723<dd><p>Parse a <code class="file docutils literal notranslate"><span class="pre">config.h</span></code>-style file.</p>724<p><em>fp</em> is a file-like object pointing to the <code class="file docutils literal notranslate"><span class="pre">config.h</span></code>-like file.</p>725<p>A dictionary containing name/value pairs is returned. If an optional726dictionary is passed in as the second argument, it is used instead of a new727dictionary, and updated with the values read in the file.</p>728</dd></dl>729 730<dl class="py function">731<dt class="sig sig-object py" id="sysconfig.get_config_h_filename">732<span class="sig-prename descclassname"><span class="pre">sysconfig.</span></span><span class="sig-name descname"><span class="pre">get_config_h_filename</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#sysconfig.get_config_h_filename" title="Link to this definition">¶</a></dt>733<dd><p>Return the path of <code class="file docutils literal notranslate"><span class="pre">pyconfig.h</span></code>.</p>734</dd></dl>735 736<dl class="py function">737<dt class="sig sig-object py" id="sysconfig.get_makefile_filename">738<span class="sig-prename descclassname"><span class="pre">sysconfig.</span></span><span class="sig-name descname"><span class="pre">get_makefile_filename</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#sysconfig.get_makefile_filename" title="Link to this definition">¶</a></dt>739<dd><p>Return the path of <code class="file docutils literal notranslate"><span class="pre">Makefile</span></code>.</p>740</dd></dl>741 742</section>743<section id="command-line-usage">744<span id="using-sysconfig-as-a-script"></span><span id="sysconfig-cli"></span><h2>Command-line usage<a class="headerlink" href="#command-line-usage" title="Link to this heading">¶</a></h2>745<p>You can use <code class="xref py py-mod docutils literal notranslate"><span class="pre">sysconfig</span></code> as a script with Python’s <em>-m</em> option:</p>746<div class="highlight-shell-session notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>python<span class="w"> </span>-m<span class="w"> </span>sysconfig747<span class="go">Platform: "macosx-10.4-i386"</span>748<span class="go">Python version: "3.2"</span>749<span class="go">Current installation scheme: "posix_prefix"</span>750 751<span class="go">Paths:</span>752<span class="go"> data = "/usr/local"</span>753<span class="go"> include = "/Users/tarek/Dev/svn.python.org/py3k/Include"</span>754<span class="go"> platinclude = "."</span>755<span class="go"> platlib = "/usr/local/lib/python3.2/site-packages"</span>756<span class="go"> platstdlib = "/usr/local/lib/python3.2"</span>757<span class="go"> purelib = "/usr/local/lib/python3.2/site-packages"</span>758<span class="go"> scripts = "/usr/local/bin"</span>759<span class="go"> stdlib = "/usr/local/lib/python3.2"</span>760 761<span class="go">Variables:</span>762<span class="go"> AC_APPLE_UNIVERSAL_BUILD = "0"</span>763<span class="go"> AIX_GENUINE_CPLUSPLUS = "0"</span>764<span class="go"> AR = "ar"</span>765<span class="go"> ARFLAGS = "rc"</span>766<span class="go"> ...</span>767</pre></div>768</div>769<p>This call will print in the standard output the information returned by770<a class="reference internal" href="#sysconfig.get_platform" title="sysconfig.get_platform"><code class="xref py py-func docutils literal notranslate"><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 notranslate"><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 notranslate"><span class="pre">get_path()</span></code></a> and771<a class="reference internal" href="#sysconfig.get_config_vars" title="sysconfig.get_config_vars"><code class="xref py py-func docutils literal notranslate"><span class="pre">get_config_vars()</span></code></a>.</p>772</section>773</section>774 775 776 <div class="clearer"></div>777 </div>778 </div>779 </div>780 <div class="sphinxsidebar" role="navigation" aria-label="Main">781 <div class="sphinxsidebarwrapper">782 <div>783 <h3><a href="../contents.html">Table of Contents</a></h3>784 <ul>785<li><a class="reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sysconfig</span></code> — Provide access to Python’s configuration information</a><ul>786<li><a class="reference internal" href="#configuration-variables">Configuration variables</a></li>787<li><a class="reference internal" href="#installation-paths">Installation paths</a></li>788<li><a class="reference internal" href="#user-scheme">User scheme</a><ul>789<li><a class="reference internal" href="#posix-user"><code class="docutils literal notranslate"><span class="pre">posix_user</span></code></a></li>790<li><a class="reference internal" href="#nt-user"><code class="docutils literal notranslate"><span class="pre">nt_user</span></code></a></li>791<li><a class="reference internal" href="#osx-framework-user"><code class="docutils literal notranslate"><span class="pre">osx_framework_user</span></code></a></li>792</ul>793</li>794<li><a class="reference internal" href="#home-scheme">Home scheme</a><ul>795<li><a class="reference internal" href="#posix-home"><code class="docutils literal notranslate"><span class="pre">posix_home</span></code></a></li>796</ul>797</li>798<li><a class="reference internal" href="#prefix-scheme">Prefix scheme</a><ul>799<li><a class="reference internal" href="#posix-prefix"><code class="docutils literal notranslate"><span class="pre">posix_prefix</span></code></a></li>800<li><a class="reference internal" href="#nt"><code class="docutils literal notranslate"><span class="pre">nt</span></code></a></li>801</ul>802</li>803<li><a class="reference internal" href="#installation-path-functions">Installation path functions</a></li>804<li><a class="reference internal" href="#other-functions">Other functions</a></li>805<li><a class="reference internal" href="#command-line-usage">Command-line usage</a></li>806</ul>807</li>808</ul>809 810 </div>811 <div>812 <h4>Previous topic</h4>813 <p class="topless"><a href="sys.monitoring.html"814 title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sys.monitoring</span></code> — Execution event monitoring</a></p>815 </div>816 <div>817 <h4>Next topic</h4>818 <p class="topless"><a href="builtins.html"819 title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">builtins</span></code> — Built-in objects</a></p>820 </div>821 <script>822 document.addEventListener('DOMContentLoaded', () => {823 const title = document.querySelector('meta[property="og:title"]').content;824 const elements = document.querySelectorAll('.improvepage');825 const pageurl = window.location.href.split('?')[0];826 elements.forEach(element => {827 const url = new URL(element.href.split('?')[0].replace("-nojs", ""));828 url.searchParams.set('pagetitle', title);829 url.searchParams.set('pageurl', pageurl);830 url.searchParams.set('pagesource', "library/sysconfig.rst");831 element.href = url.toString();832 });833 });834 </script>835 <div role="note" aria-label="source link">836 <h3>This page</h3>837 <ul class="this-page-menu">838 <li><a href="../bugs.html">Report a bug</a></li>839 <li><a class="improvepage" href="../improve-page-nojs.html">Improve this page</a></li>840 <li>841 <a href="https://github.com/python/cpython/blob/main/Doc/library/sysconfig.rst?plain=1"842 rel="nofollow">Show source843 </a>844 </li>845 846 </ul>847 </div>848 </div>849<div id="sidebarbutton" title="Collapse sidebar">850<span>«</span>851</div>852 853 </div>854 <div class="clearer"></div>855 </div> 856 <div class="related" role="navigation" aria-label="Related">857 <h3>Navigation</h3>858 <ul>859 <li class="right" style="margin-right: 10px">860 <a href="../genindex.html" title="General Index"861 >index</a></li>862 <li class="right" >863 <a href="../py-modindex.html" title="Python Module Index"864 >modules</a> |</li>865 <li class="right" >866 <a href="builtins.html" title="builtins — Built-in objects"867 >next</a> |</li>868 <li class="right" >869 <a href="sys.monitoring.html" title="sys.monitoring — Execution event monitoring"870 >previous</a> |</li>871 872 <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"></li>873 <li><a href="https://www.python.org/">Python</a> »</li>874 <li class="switchers">875 <div class="language_switcher_placeholder"></div>876 <div class="version_switcher_placeholder"></div>877 </li>878 <li>879 880 </li>881 <li id="cpython-language-and-version">882 <a href="../index.html">3.15.0a6 Documentation</a> »883 </li>884 885 <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> »</li>886 <li class="nav-item nav-item-2"><a href="python.html" >Python Runtime Services</a> »</li>887 <li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">sysconfig</span></code> — Provide access to Python’s configuration information</a></li>888 <li class="right">889 890 891 <div class="inline-search" role="search">892 <form class="inline-search" action="../search.html" method="get">893 <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box">894 <input type="submit" value="Go">895 </form>896 </div>897 |898 </li>899 <li class="right">900<label class="theme-selector-label">901 Theme902 <select class="theme-selector" oninput="activateTheme(this.value)">903 <option value="auto" selected>Auto</option>904 <option value="light">Light</option>905 <option value="dark">Dark</option>906 </select>907</label> |</li>908 909 </ul>910 </div> 911 <div class="footer">912 © <a href="../copyright.html">Copyright</a> 2001 Python Software Foundation.913 <br>914 This page is licensed under the Python Software Foundation License Version 2.915 <br>916 Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.917 <br>918 919 See <a href="/license.html">History and License</a> for more information.<br>920 921 922 <br>923 924 The Python Software Foundation is a non-profit corporation.925<a href="https://www.python.org/psf/donations/">Please donate.</a>926<br>927 <br>928 Last updated on Mar 10, 2026 (08:58 UTC).929 930 <a href="/bugs.html">Found a bug</a>?931 932 <br>933 934 Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.2.3.935 </div>936 937 </body>938</html>