gooderp18绿色标准版
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

1587 行
117KB

  1. <!DOCTYPE html>
  2. <html lang="en" data-content_root="../">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
  6. <meta property="og:title" content="3. Configure Python" />
  7. <meta property="og:type" content="website" />
  8. <meta property="og:url" content="https://docs.python.org/3/using/configure.html" />
  9. <meta property="og:site_name" content="Python documentation" />
  10. <meta property="og:description" content="Build Requirements: Features required to build CPython: A C11 compiler. Optional C11 features are not required., Support for IEEE 754 floating point numbers and floating point Not-a-Number (NaN)., ..." />
  11. <meta property="og:image" content="https://docs.python.org/3/_static/og-image.png" />
  12. <meta property="og:image:alt" content="Python documentation" />
  13. <meta name="description" content="Build Requirements: Features required to build CPython: A C11 compiler. Optional C11 features are not required., Support for IEEE 754 floating point numbers and floating point Not-a-Number (NaN)., ..." />
  14. <meta property="og:image:width" content="200" />
  15. <meta property="og:image:height" content="200" />
  16. <meta name="theme-color" content="#3776ab" />
  17. <title>3. Configure Python &#8212; Python 3.12.3 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0">
  18. <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=80d5e7a1" />
  19. <link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?v=bb723527" />
  20. <link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css?v=b20cc3f5" />
  21. <script src="../_static/documentation_options.js?v=2c828074"></script>
  22. <script src="../_static/doctools.js?v=888ff710"></script>
  23. <script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
  24. <script src="../_static/sidebar.js"></script>
  25. <link rel="search" type="application/opensearchdescription+xml"
  26. title="Search within Python 3.12.3 documentation"
  27. href="../_static/opensearch.xml"/>
  28. <link rel="author" title="About these documents" href="../about.html" />
  29. <link rel="index" title="Index" href="../genindex.html" />
  30. <link rel="search" title="Search" href="../search.html" />
  31. <link rel="copyright" title="Copyright" href="../copyright.html" />
  32. <link rel="next" title="4. Using Python on Windows" href="windows.html" />
  33. <link rel="prev" title="2. Using Python on Unix platforms" href="unix.html" />
  34. <link rel="canonical" href="https://docs.python.org/3/using/configure.html" />
  35. <style>
  36. @media only screen {
  37. table.full-width-table {
  38. width: 100%;
  39. }
  40. }
  41. </style>
  42. <link rel="stylesheet" href="../_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">
  43. <link rel="shortcut icon" type="image/png" href="../_static/py.svg" />
  44. <script type="text/javascript" src="../_static/copybutton.js"></script>
  45. <script type="text/javascript" src="../_static/menu.js"></script>
  46. <script type="text/javascript" src="../_static/search-focus.js"></script>
  47. <script type="text/javascript" src="../_static/themetoggle.js"></script>
  48. </head>
  49. <body>
  50. <div class="mobile-nav">
  51. <input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"
  52. aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu" />
  53. <nav class="nav-content" role="navigation">
  54. <label for="menuToggler" class="toggler__label">
  55. <span></span>
  56. </label>
  57. <span class="nav-items-wrapper">
  58. <a href="https://www.python.org/" class="nav-logo">
  59. <img src="../_static/py.svg" alt="Python logo"/>
  60. </a>
  61. <span class="version_switcher_placeholder"></span>
  62. <form role="search" class="search" action="../search.html" method="get">
  63. <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">
  64. <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>
  65. </svg>
  66. <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" />
  67. <input type="submit" value="Go"/>
  68. </form>
  69. </span>
  70. </nav>
  71. <div class="menu-wrapper">
  72. <nav class="menu" role="navigation" aria-label="main navigation">
  73. <div class="language_switcher_placeholder"></div>
  74. <label class="theme-selector-label">
  75. Theme
  76. <select class="theme-selector" oninput="activateTheme(this.value)">
  77. <option value="auto" selected>Auto</option>
  78. <option value="light">Light</option>
  79. <option value="dark">Dark</option>
  80. </select>
  81. </label>
  82. <div>
  83. <h3><a href="../contents.html">Table of Contents</a></h3>
  84. <ul>
  85. <li><a class="reference internal" href="#">3. Configure Python</a><ul>
  86. <li><a class="reference internal" href="#build-requirements">3.1. Build Requirements</a></li>
  87. <li><a class="reference internal" href="#generated-files">3.2. Generated files</a><ul>
  88. <li><a class="reference internal" href="#configure-script">3.2.1. configure script</a></li>
  89. </ul>
  90. </li>
  91. <li><a class="reference internal" href="#configure-options">3.3. Configure Options</a><ul>
  92. <li><a class="reference internal" href="#general-options">3.3.1. General Options</a></li>
  93. <li><a class="reference internal" href="#webassembly-options">3.3.2. WebAssembly Options</a></li>
  94. <li><a class="reference internal" href="#install-options">3.3.3. Install Options</a></li>
  95. <li><a class="reference internal" href="#performance-options">3.3.4. Performance options</a></li>
  96. <li><a class="reference internal" href="#python-debug-build">3.3.5. Python Debug Build</a></li>
  97. <li><a class="reference internal" href="#debug-options">3.3.6. Debug options</a></li>
  98. <li><a class="reference internal" href="#linker-options">3.3.7. Linker options</a></li>
  99. <li><a class="reference internal" href="#libraries-options">3.3.8. Libraries options</a></li>
  100. <li><a class="reference internal" href="#security-options">3.3.9. Security Options</a></li>
  101. <li><a class="reference internal" href="#macos-options">3.3.10. macOS Options</a></li>
  102. <li><a class="reference internal" href="#cross-compiling-options">3.3.11. Cross Compiling Options</a></li>
  103. </ul>
  104. </li>
  105. <li><a class="reference internal" href="#python-build-system">3.4. Python Build System</a><ul>
  106. <li><a class="reference internal" href="#main-files-of-the-build-system">3.4.1. Main files of the build system</a></li>
  107. <li><a class="reference internal" href="#main-build-steps">3.4.2. Main build steps</a></li>
  108. <li><a class="reference internal" href="#main-makefile-targets">3.4.3. Main Makefile targets</a></li>
  109. <li><a class="reference internal" href="#c-extensions">3.4.4. C extensions</a></li>
  110. </ul>
  111. </li>
  112. <li><a class="reference internal" href="#compiler-and-linker-flags">3.5. Compiler and linker flags</a><ul>
  113. <li><a class="reference internal" href="#preprocessor-flags">3.5.1. Preprocessor flags</a></li>
  114. <li><a class="reference internal" href="#compiler-flags">3.5.2. Compiler flags</a></li>
  115. <li><a class="reference internal" href="#linker-flags">3.5.3. Linker flags</a></li>
  116. </ul>
  117. </li>
  118. </ul>
  119. </li>
  120. </ul>
  121. </div>
  122. <div>
  123. <h4>Previous topic</h4>
  124. <p class="topless"><a href="unix.html"
  125. title="previous chapter"><span class="section-number">2. </span>Using Python on Unix platforms</a></p>
  126. </div>
  127. <div>
  128. <h4>Next topic</h4>
  129. <p class="topless"><a href="windows.html"
  130. title="next chapter"><span class="section-number">4. </span>Using Python on Windows</a></p>
  131. </div>
  132. <div role="note" aria-label="source link">
  133. <h3>This Page</h3>
  134. <ul class="this-page-menu">
  135. <li><a href="../bugs.html">Report a Bug</a></li>
  136. <li>
  137. <a href="https://github.com/python/cpython/blob/main/Doc/using/configure.rst"
  138. rel="nofollow">Show Source
  139. </a>
  140. </li>
  141. </ul>
  142. </div>
  143. </nav>
  144. </div>
  145. </div>
  146. <div class="related" role="navigation" aria-label="related navigation">
  147. <h3>Navigation</h3>
  148. <ul>
  149. <li class="right" style="margin-right: 10px">
  150. <a href="../genindex.html" title="General Index"
  151. accesskey="I">index</a></li>
  152. <li class="right" >
  153. <a href="../py-modindex.html" title="Python Module Index"
  154. >modules</a> |</li>
  155. <li class="right" >
  156. <a href="windows.html" title="4. Using Python on Windows"
  157. accesskey="N">next</a> |</li>
  158. <li class="right" >
  159. <a href="unix.html" title="2. Using Python on Unix platforms"
  160. accesskey="P">previous</a> |</li>
  161. <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
  162. <li><a href="https://www.python.org/">Python</a> &#187;</li>
  163. <li class="switchers">
  164. <div class="language_switcher_placeholder"></div>
  165. <div class="version_switcher_placeholder"></div>
  166. </li>
  167. <li>
  168. </li>
  169. <li id="cpython-language-and-version">
  170. <a href="../index.html">3.12.3 Documentation</a> &#187;
  171. </li>
  172. <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Python Setup and Usage</a> &#187;</li>
  173. <li class="nav-item nav-item-this"><a href=""><span class="section-number">3. </span>Configure Python</a></li>
  174. <li class="right">
  175. <div class="inline-search" role="search">
  176. <form class="inline-search" action="../search.html" method="get">
  177. <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
  178. <input type="submit" value="Go" />
  179. </form>
  180. </div>
  181. |
  182. </li>
  183. <li class="right">
  184. <label class="theme-selector-label">
  185. Theme
  186. <select class="theme-selector" oninput="activateTheme(this.value)">
  187. <option value="auto" selected>Auto</option>
  188. <option value="light">Light</option>
  189. <option value="dark">Dark</option>
  190. </select>
  191. </label> |</li>
  192. </ul>
  193. </div>
  194. <div class="document">
  195. <div class="documentwrapper">
  196. <div class="bodywrapper">
  197. <div class="body" role="main">
  198. <section id="configure-python">
  199. <h1><span class="section-number">3. </span>Configure Python<a class="headerlink" href="#configure-python" title="Link to this heading">¶</a></h1>
  200. <section id="build-requirements">
  201. <h2><span class="section-number">3.1. </span>Build Requirements<a class="headerlink" href="#build-requirements" title="Link to this heading">¶</a></h2>
  202. <p>Features required to build CPython:</p>
  203. <ul class="simple">
  204. <li><p>A <a class="reference external" href="https://en.cppreference.com/w/c/11">C11</a> compiler. <a class="reference external" href="https://en.wikipedia.org/wiki/C11_(C_standard_revision)#Optional_features">Optional C11
  205. features</a>
  206. are not required.</p></li>
  207. <li><p>Support for <a class="reference external" href="https://en.wikipedia.org/wiki/IEEE_754">IEEE 754</a> floating
  208. point numbers and <a class="reference external" href="https://en.wikipedia.org/wiki/NaN#Floating_point">floating point Not-a-Number (NaN)</a>.</p></li>
  209. <li><p>Support for threads.</p></li>
  210. <li><p>OpenSSL 1.1.1 or newer for the <a class="reference internal" href="../library/ssl.html#module-ssl" title="ssl: TLS/SSL wrapper for socket objects"><code class="xref py py-mod docutils literal notranslate"><span class="pre">ssl</span></code></a> and <a class="reference internal" href="../library/hashlib.html#module-hashlib" title="hashlib: Secure hash and message digest algorithms."><code class="xref py py-mod docutils literal notranslate"><span class="pre">hashlib</span></code></a> modules.</p></li>
  211. <li><p>On Windows, Microsoft Visual Studio 2017 or later is required.</p></li>
  212. </ul>
  213. <div class="versionchanged">
  214. <p><span class="versionmodified changed">Changed in version 3.5: </span>On Windows, Visual Studio 2015 or later is required.</p>
  215. </div>
  216. <div class="versionchanged">
  217. <p><span class="versionmodified changed">Changed in version 3.6: </span>Selected C99 features are now required, like <code class="docutils literal notranslate"><span class="pre">&lt;stdint.h&gt;</span></code> and <code class="docutils literal notranslate"><span class="pre">static</span>
  218. <span class="pre">inline</span></code> functions.</p>
  219. </div>
  220. <div class="versionchanged">
  221. <p><span class="versionmodified changed">Changed in version 3.7: </span>Thread support and OpenSSL 1.0.2 are now required.</p>
  222. </div>
  223. <div class="versionchanged">
  224. <p><span class="versionmodified changed">Changed in version 3.10: </span>OpenSSL 1.1.1 is now required.</p>
  225. </div>
  226. <div class="versionchanged">
  227. <p><span class="versionmodified changed">Changed in version 3.11: </span>C11 compiler, IEEE 754 and NaN support are now required.
  228. On Windows, Visual Studio 2017 or later is required.</p>
  229. </div>
  230. <p>See also <span class="target" id="index-0"></span><a class="pep reference external" href="https://peps.python.org/pep-0007/"><strong>PEP 7</strong></a> “Style Guide for C Code” and <span class="target" id="index-1"></span><a class="pep reference external" href="https://peps.python.org/pep-0011/"><strong>PEP 11</strong></a> “CPython platform
  231. support”.</p>
  232. </section>
  233. <section id="generated-files">
  234. <h2><span class="section-number">3.2. </span>Generated files<a class="headerlink" href="#generated-files" title="Link to this heading">¶</a></h2>
  235. <p>To reduce build dependencies, Python source code contains multiple generated
  236. files. Commands to regenerate all generated files:</p>
  237. <div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>make<span class="w"> </span>regen-all
  238. make<span class="w"> </span>regen-stdlib-module-names
  239. make<span class="w"> </span>regen-limited-abi
  240. make<span class="w"> </span>regen-configure
  241. </pre></div>
  242. </div>
  243. <p>The <code class="docutils literal notranslate"><span class="pre">Makefile.pre.in</span></code> file documents generated files, their inputs, and tools used
  244. to regenerate them. Search for <code class="docutils literal notranslate"><span class="pre">regen-*</span></code> make targets.</p>
  245. <section id="configure-script">
  246. <h3><span class="section-number">3.2.1. </span>configure script<a class="headerlink" href="#configure-script" title="Link to this heading">¶</a></h3>
  247. <p>The <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">regen-configure</span></code> command regenerates the <code class="docutils literal notranslate"><span class="pre">aclocal.m4</span></code> file and
  248. the <code class="docutils literal notranslate"><span class="pre">configure</span></code> script using the <code class="docutils literal notranslate"><span class="pre">Tools/build/regen-configure.sh</span></code> shell
  249. script which uses an Ubuntu container to get the same tools versions and have a
  250. reproducible output.</p>
  251. <p>The container is optional, the following command can be run locally:</p>
  252. <div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>autoreconf<span class="w"> </span>-ivf<span class="w"> </span>-Werror
  253. </pre></div>
  254. </div>
  255. <p>The generated files can change depending on the exact <code class="docutils literal notranslate"><span class="pre">autoconf-archive</span></code>,
  256. <code class="docutils literal notranslate"><span class="pre">aclocal</span></code> and <code class="docutils literal notranslate"><span class="pre">pkg-config</span></code> versions.</p>
  257. </section>
  258. </section>
  259. <section id="configure-options">
  260. <span id="id1"></span><h2><span class="section-number">3.3. </span>Configure Options<a class="headerlink" href="#configure-options" title="Link to this heading">¶</a></h2>
  261. <p>List all <code class="docutils literal notranslate"><span class="pre">./configure</span></code> script options using:</p>
  262. <div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>./configure<span class="w"> </span>--help
  263. </pre></div>
  264. </div>
  265. <p>See also the <code class="file docutils literal notranslate"><span class="pre">Misc/SpecialBuilds.txt</span></code> in the Python source distribution.</p>
  266. <section id="general-options">
  267. <h3><span class="section-number">3.3.1. </span>General Options<a class="headerlink" href="#general-options" title="Link to this heading">¶</a></h3>
  268. <dl class="std option">
  269. <dt class="sig sig-object std" id="cmdoption-enable-loadable-sqlite-extensions">
  270. <span class="sig-name descname"><span class="pre">--enable-loadable-sqlite-extensions</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-enable-loadable-sqlite-extensions" title="Link to this definition">¶</a></dt>
  271. <dd><p>Support loadable extensions in the <code class="xref py py-mod docutils literal notranslate"><span class="pre">_sqlite</span></code> extension module (default
  272. is no) of the <a class="reference internal" href="../library/sqlite3.html#module-sqlite3" title="sqlite3: A DB-API 2.0 implementation using SQLite 3.x."><code class="xref py py-mod docutils literal notranslate"><span class="pre">sqlite3</span></code></a> module.</p>
  273. <p>See the <a class="reference internal" href="../library/sqlite3.html#sqlite3.Connection.enable_load_extension" title="sqlite3.Connection.enable_load_extension"><code class="xref py py-meth docutils literal notranslate"><span class="pre">sqlite3.Connection.enable_load_extension()</span></code></a> method of the
  274. <a class="reference internal" href="../library/sqlite3.html#module-sqlite3" title="sqlite3: A DB-API 2.0 implementation using SQLite 3.x."><code class="xref py py-mod docutils literal notranslate"><span class="pre">sqlite3</span></code></a> module.</p>
  275. <div class="versionadded">
  276. <p><span class="versionmodified added">New in version 3.6.</span></p>
  277. </div>
  278. </dd></dl>
  279. <dl class="std option">
  280. <dt class="sig sig-object std" id="cmdoption-disable-ipv6">
  281. <span class="sig-name descname"><span class="pre">--disable-ipv6</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-disable-ipv6" title="Link to this definition">¶</a></dt>
  282. <dd><p>Disable IPv6 support (enabled by default if supported), see the
  283. <a class="reference internal" href="../library/socket.html#module-socket" title="socket: Low-level networking interface."><code class="xref py py-mod docutils literal notranslate"><span class="pre">socket</span></code></a> module.</p>
  284. </dd></dl>
  285. <dl class="std option">
  286. <dt class="sig sig-object std" id="cmdoption-enable-big-digits">
  287. <span class="sig-name descname"><span class="pre">--enable-big-digits</span></span><span class="sig-prename descclassname"><span class="pre">=[15|30]</span></span><a class="headerlink" href="#cmdoption-enable-big-digits" title="Link to this definition">¶</a></dt>
  288. <dd><p>Define the size in bits of Python <a class="reference internal" href="../library/functions.html#int" title="int"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a> digits: 15 or 30 bits.</p>
  289. <p>By default, the digit size is 30.</p>
  290. <p>Define the <code class="docutils literal notranslate"><span class="pre">PYLONG_BITS_IN_DIGIT</span></code> to <code class="docutils literal notranslate"><span class="pre">15</span></code> or <code class="docutils literal notranslate"><span class="pre">30</span></code>.</p>
  291. <p>See <a class="reference internal" href="../library/sys.html#sys.int_info" title="sys.int_info"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys.int_info.bits_per_digit</span></code></a>.</p>
  292. </dd></dl>
  293. <dl class="std option">
  294. <dt class="sig sig-object std" id="cmdoption-with-suffix">
  295. <span class="sig-name descname"><span class="pre">--with-suffix</span></span><span class="sig-prename descclassname"><span class="pre">=SUFFIX</span></span><a class="headerlink" href="#cmdoption-with-suffix" title="Link to this definition">¶</a></dt>
  296. <dd><p>Set the Python executable suffix to <em>SUFFIX</em>.</p>
  297. <p>The default suffix is <code class="docutils literal notranslate"><span class="pre">.exe</span></code> on Windows and macOS (<code class="docutils literal notranslate"><span class="pre">python.exe</span></code>
  298. executable), <code class="docutils literal notranslate"><span class="pre">.js</span></code> on Emscripten node, <code class="docutils literal notranslate"><span class="pre">.html</span></code> on Emscripten browser,
  299. <code class="docutils literal notranslate"><span class="pre">.wasm</span></code> on WASI, and an empty string on other platforms (<code class="docutils literal notranslate"><span class="pre">python</span></code>
  300. executable).</p>
  301. <div class="versionchanged">
  302. <p><span class="versionmodified changed">Changed in version 3.11: </span>The default suffix on WASM platform is one of <code class="docutils literal notranslate"><span class="pre">.js</span></code>, <code class="docutils literal notranslate"><span class="pre">.html</span></code>
  303. or <code class="docutils literal notranslate"><span class="pre">.wasm</span></code>.</p>
  304. </div>
  305. </dd></dl>
  306. <dl class="std option">
  307. <dt class="sig sig-object std" id="cmdoption-with-tzpath">
  308. <span class="sig-name descname"><span class="pre">--with-tzpath</span></span><span class="sig-prename descclassname"><span class="pre">=&lt;list</span> <span class="pre">of</span> <span class="pre">absolute</span> <span class="pre">paths</span> <span class="pre">separated</span> <span class="pre">by</span> <span class="pre">pathsep&gt;</span></span><a class="headerlink" href="#cmdoption-with-tzpath" title="Link to this definition">¶</a></dt>
  309. <dd><p>Select the default time zone search path for <a class="reference internal" href="../library/zoneinfo.html#zoneinfo.TZPATH" title="zoneinfo.TZPATH"><code class="xref py py-const docutils literal notranslate"><span class="pre">zoneinfo.TZPATH</span></code></a>.
  310. See the <a class="reference internal" href="../library/zoneinfo.html#zoneinfo-data-compile-time-config"><span class="std std-ref">Compile-time configuration</span></a> of the <a class="reference internal" href="../library/zoneinfo.html#module-zoneinfo" title="zoneinfo: IANA time zone support"><code class="xref py py-mod docutils literal notranslate"><span class="pre">zoneinfo</span></code></a> module.</p>
  311. <p>Default: <code class="docutils literal notranslate"><span class="pre">/usr/share/zoneinfo:/usr/lib/zoneinfo:/usr/share/lib/zoneinfo:/etc/zoneinfo</span></code>.</p>
  312. <p>See <a class="reference internal" href="../library/os.html#os.pathsep" title="os.pathsep"><code class="xref py py-data docutils literal notranslate"><span class="pre">os.pathsep</span></code></a> path separator.</p>
  313. <div class="versionadded">
  314. <p><span class="versionmodified added">New in version 3.9.</span></p>
  315. </div>
  316. </dd></dl>
  317. <dl class="std option">
  318. <dt class="sig sig-object std" id="cmdoption-without-decimal-contextvar">
  319. <span class="sig-name descname"><span class="pre">--without-decimal-contextvar</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-without-decimal-contextvar" title="Link to this definition">¶</a></dt>
  320. <dd><p>Build the <code class="docutils literal notranslate"><span class="pre">_decimal</span></code> extension module using a thread-local context rather
  321. than a coroutine-local context (default), see the <a class="reference internal" href="../library/decimal.html#module-decimal" title="decimal: Implementation of the General Decimal Arithmetic Specification."><code class="xref py py-mod docutils literal notranslate"><span class="pre">decimal</span></code></a> module.</p>
  322. <p>See <a class="reference internal" href="../library/decimal.html#decimal.HAVE_CONTEXTVAR" title="decimal.HAVE_CONTEXTVAR"><code class="xref py py-const docutils literal notranslate"><span class="pre">decimal.HAVE_CONTEXTVAR</span></code></a> and the <a class="reference internal" href="../library/contextvars.html#module-contextvars" title="contextvars: Context Variables"><code class="xref py py-mod docutils literal notranslate"><span class="pre">contextvars</span></code></a> module.</p>
  323. <div class="versionadded">
  324. <p><span class="versionmodified added">New in version 3.9.</span></p>
  325. </div>
  326. </dd></dl>
  327. <dl class="std option">
  328. <dt class="sig sig-object std" id="cmdoption-with-dbmliborder">
  329. <span class="sig-name descname"><span class="pre">--with-dbmliborder</span></span><span class="sig-prename descclassname"><span class="pre">=&lt;list</span> <span class="pre">of</span> <span class="pre">backend</span> <span class="pre">names&gt;</span></span><a class="headerlink" href="#cmdoption-with-dbmliborder" title="Link to this definition">¶</a></dt>
  330. <dd><p>Override order to check db backends for the <a class="reference internal" href="../library/dbm.html#module-dbm" title="dbm: Interfaces to various Unix &quot;database&quot; formats."><code class="xref py py-mod docutils literal notranslate"><span class="pre">dbm</span></code></a> module</p>
  331. <p>A valid value is a colon (<code class="docutils literal notranslate"><span class="pre">:</span></code>) separated string with the backend names:</p>
  332. <ul class="simple">
  333. <li><p><code class="docutils literal notranslate"><span class="pre">ndbm</span></code>;</p></li>
  334. <li><p><code class="docutils literal notranslate"><span class="pre">gdbm</span></code>;</p></li>
  335. <li><p><code class="docutils literal notranslate"><span class="pre">bdb</span></code>.</p></li>
  336. </ul>
  337. </dd></dl>
  338. <dl class="std option">
  339. <dt class="sig sig-object std" id="cmdoption-without-c-locale-coercion">
  340. <span class="sig-name descname"><span class="pre">--without-c-locale-coercion</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-without-c-locale-coercion" title="Link to this definition">¶</a></dt>
  341. <dd><p>Disable C locale coercion to a UTF-8 based locale (enabled by default).</p>
  342. <p>Don’t define the <code class="docutils literal notranslate"><span class="pre">PY_COERCE_C_LOCALE</span></code> macro.</p>
  343. <p>See <span class="target" id="index-2"></span><a class="reference internal" href="cmdline.html#envvar-PYTHONCOERCECLOCALE"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">PYTHONCOERCECLOCALE</span></code></a> and the <span class="target" id="index-3"></span><a class="pep reference external" href="https://peps.python.org/pep-0538/"><strong>PEP 538</strong></a>.</p>
  344. </dd></dl>
  345. <dl class="std option">
  346. <dt class="sig sig-object std" id="cmdoption-without-freelists">
  347. <span class="sig-name descname"><span class="pre">--without-freelists</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-without-freelists" title="Link to this definition">¶</a></dt>
  348. <dd><p>Disable all freelists except the empty tuple singleton.</p>
  349. <div class="versionadded">
  350. <p><span class="versionmodified added">New in version 3.11.</span></p>
  351. </div>
  352. </dd></dl>
  353. <dl class="std option">
  354. <dt class="sig sig-object std" id="cmdoption-with-platlibdir">
  355. <span class="sig-name descname"><span class="pre">--with-platlibdir</span></span><span class="sig-prename descclassname"><span class="pre">=DIRNAME</span></span><a class="headerlink" href="#cmdoption-with-platlibdir" title="Link to this definition">¶</a></dt>
  356. <dd><p>Python library directory name (default is <code class="docutils literal notranslate"><span class="pre">lib</span></code>).</p>
  357. <p>Fedora and SuSE use <code class="docutils literal notranslate"><span class="pre">lib64</span></code> on 64-bit platforms.</p>
  358. <p>See <a class="reference internal" href="../library/sys.html#sys.platlibdir" title="sys.platlibdir"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys.platlibdir</span></code></a>.</p>
  359. <div class="versionadded">
  360. <p><span class="versionmodified added">New in version 3.9.</span></p>
  361. </div>
  362. </dd></dl>
  363. <dl class="std option">
  364. <dt class="sig sig-object std" id="cmdoption-with-wheel-pkg-dir">
  365. <span class="sig-name descname"><span class="pre">--with-wheel-pkg-dir</span></span><span class="sig-prename descclassname"><span class="pre">=PATH</span></span><a class="headerlink" href="#cmdoption-with-wheel-pkg-dir" title="Link to this definition">¶</a></dt>
  366. <dd><p>Directory of wheel packages used by the <a class="reference internal" href="../library/ensurepip.html#module-ensurepip" title="ensurepip: Bootstrapping the &quot;pip&quot; installer into an existing Python installation or virtual environment."><code class="xref py py-mod docutils literal notranslate"><span class="pre">ensurepip</span></code></a> module
  367. (none by default).</p>
  368. <p>Some Linux distribution packaging policies recommend against bundling
  369. dependencies. For example, Fedora installs wheel packages in the
  370. <code class="docutils literal notranslate"><span class="pre">/usr/share/python-wheels/</span></code> directory and don’t install the
  371. <code class="xref py py-mod docutils literal notranslate"><span class="pre">ensurepip._bundled</span></code> package.</p>
  372. <div class="versionadded">
  373. <p><span class="versionmodified added">New in version 3.10.</span></p>
  374. </div>
  375. </dd></dl>
  376. <dl class="std option">
  377. <dt class="sig sig-object std" id="cmdoption-with-pkg-config">
  378. <span class="sig-name descname"><span class="pre">--with-pkg-config</span></span><span class="sig-prename descclassname"><span class="pre">=[check|yes|no]</span></span><a class="headerlink" href="#cmdoption-with-pkg-config" title="Link to this definition">¶</a></dt>
  379. <dd><p>Whether configure should use <strong class="program">pkg-config</strong> to detect build
  380. dependencies.</p>
  381. <ul class="simple">
  382. <li><p><code class="docutils literal notranslate"><span class="pre">check</span></code> (default): <strong class="program">pkg-config</strong> is optional</p></li>
  383. <li><p><code class="docutils literal notranslate"><span class="pre">yes</span></code>: <strong class="program">pkg-config</strong> is mandatory</p></li>
  384. <li><p><code class="docutils literal notranslate"><span class="pre">no</span></code>: configure does not use <strong class="program">pkg-config</strong> even when present</p></li>
  385. </ul>
  386. <div class="versionadded">
  387. <p><span class="versionmodified added">New in version 3.11.</span></p>
  388. </div>
  389. </dd></dl>
  390. <dl class="std option">
  391. <dt class="sig sig-object std" id="cmdoption-enable-pystats">
  392. <span class="sig-name descname"><span class="pre">--enable-pystats</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-enable-pystats" title="Link to this definition">¶</a></dt>
  393. <dd><p>Turn on internal statistics gathering.</p>
  394. <p>The statistics will be dumped to a arbitrary (probably unique) file in
  395. <code class="docutils literal notranslate"><span class="pre">/tmp/py_stats/</span></code>, or <code class="docutils literal notranslate"><span class="pre">C:\temp\py_stats\</span></code> on Windows. If that directory
  396. does not exist, results will be printed on stdout.</p>
  397. <p>Use <code class="docutils literal notranslate"><span class="pre">Tools/scripts/summarize_stats.py</span></code> to read the stats.</p>
  398. <div class="versionadded">
  399. <p><span class="versionmodified added">New in version 3.11.</span></p>
  400. </div>
  401. </dd></dl>
  402. </section>
  403. <section id="webassembly-options">
  404. <h3><span class="section-number">3.3.2. </span>WebAssembly Options<a class="headerlink" href="#webassembly-options" title="Link to this heading">¶</a></h3>
  405. <dl class="std option">
  406. <dt class="sig sig-object std" id="cmdoption-with-emscripten-target">
  407. <span class="sig-name descname"><span class="pre">--with-emscripten-target</span></span><span class="sig-prename descclassname"><span class="pre">=[browser|node]</span></span><a class="headerlink" href="#cmdoption-with-emscripten-target" title="Link to this definition">¶</a></dt>
  408. <dd><p>Set build flavor for <code class="docutils literal notranslate"><span class="pre">wasm32-emscripten</span></code>.</p>
  409. <ul class="simple">
  410. <li><p><code class="docutils literal notranslate"><span class="pre">browser</span></code> (default): preload minimal stdlib, default MEMFS.</p></li>
  411. <li><p><code class="docutils literal notranslate"><span class="pre">node</span></code>: NODERAWFS and pthread support.</p></li>
  412. </ul>
  413. <div class="versionadded">
  414. <p><span class="versionmodified added">New in version 3.11.</span></p>
  415. </div>
  416. </dd></dl>
  417. <dl class="std option">
  418. <dt class="sig sig-object std" id="cmdoption-enable-wasm-dynamic-linking">
  419. <span class="sig-name descname"><span class="pre">--enable-wasm-dynamic-linking</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-enable-wasm-dynamic-linking" title="Link to this definition">¶</a></dt>
  420. <dd><p>Turn on dynamic linking support for WASM.</p>
  421. <p>Dynamic linking enables <code class="docutils literal notranslate"><span class="pre">dlopen</span></code>. File size of the executable
  422. increases due to limited dead code elimination and additional features.</p>
  423. <div class="versionadded">
  424. <p><span class="versionmodified added">New in version 3.11.</span></p>
  425. </div>
  426. </dd></dl>
  427. <dl class="std option">
  428. <dt class="sig sig-object std" id="cmdoption-enable-wasm-pthreads">
  429. <span class="sig-name descname"><span class="pre">--enable-wasm-pthreads</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-enable-wasm-pthreads" title="Link to this definition">¶</a></dt>
  430. <dd><p>Turn on pthreads support for WASM.</p>
  431. <div class="versionadded">
  432. <p><span class="versionmodified added">New in version 3.11.</span></p>
  433. </div>
  434. </dd></dl>
  435. </section>
  436. <section id="install-options">
  437. <h3><span class="section-number">3.3.3. </span>Install Options<a class="headerlink" href="#install-options" title="Link to this heading">¶</a></h3>
  438. <dl class="std option">
  439. <dt class="sig sig-object std" id="cmdoption-prefix">
  440. <span class="sig-name descname"><span class="pre">--prefix</span></span><span class="sig-prename descclassname"><span class="pre">=PREFIX</span></span><a class="headerlink" href="#cmdoption-prefix" title="Link to this definition">¶</a></dt>
  441. <dd><p>Install architecture-independent files in PREFIX. On Unix, it
  442. defaults to <code class="file docutils literal notranslate"><span class="pre">/usr/local</span></code>.</p>
  443. <p>This value can be retrieved at runtime using <a class="reference internal" href="../library/sys.html#sys.prefix" title="sys.prefix"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys.prefix</span></code></a>.</p>
  444. <p>As an example, one can use <code class="docutils literal notranslate"><span class="pre">--prefix=&quot;$HOME/.local/&quot;</span></code> to install
  445. a Python in its home directory.</p>
  446. </dd></dl>
  447. <dl class="std option">
  448. <dt class="sig sig-object std" id="cmdoption-exec-prefix">
  449. <span class="sig-name descname"><span class="pre">--exec-prefix</span></span><span class="sig-prename descclassname"><span class="pre">=EPREFIX</span></span><a class="headerlink" href="#cmdoption-exec-prefix" title="Link to this definition">¶</a></dt>
  450. <dd><p>Install architecture-dependent files in EPREFIX, defaults to <a class="reference internal" href="#cmdoption-prefix"><code class="xref std std-option docutils literal notranslate"><span class="pre">--prefix</span></code></a>.</p>
  451. <p>This value can be retrieved at runtime using <a class="reference internal" href="../library/sys.html#sys.exec_prefix" title="sys.exec_prefix"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys.exec_prefix</span></code></a>.</p>
  452. </dd></dl>
  453. <dl class="std option">
  454. <dt class="sig sig-object std" id="cmdoption-disable-test-modules">
  455. <span class="sig-name descname"><span class="pre">--disable-test-modules</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-disable-test-modules" title="Link to this definition">¶</a></dt>
  456. <dd><p>Don’t build nor install test modules, like the <a class="reference internal" href="../library/test.html#module-test" title="test: Regression tests package containing the testing suite for Python."><code class="xref py py-mod docutils literal notranslate"><span class="pre">test</span></code></a> package or the
  457. <code class="xref py py-mod docutils literal notranslate"><span class="pre">_testcapi</span></code> extension module (built and installed by default).</p>
  458. <div class="versionadded">
  459. <p><span class="versionmodified added">New in version 3.10.</span></p>
  460. </div>
  461. </dd></dl>
  462. <dl class="std option">
  463. <dt class="sig sig-object std" id="cmdoption-with-ensurepip">
  464. <span class="sig-name descname"><span class="pre">--with-ensurepip</span></span><span class="sig-prename descclassname"><span class="pre">=[upgrade|install|no]</span></span><a class="headerlink" href="#cmdoption-with-ensurepip" title="Link to this definition">¶</a></dt>
  465. <dd><p>Select the <a class="reference internal" href="../library/ensurepip.html#module-ensurepip" title="ensurepip: Bootstrapping the &quot;pip&quot; installer into an existing Python installation or virtual environment."><code class="xref py py-mod docutils literal notranslate"><span class="pre">ensurepip</span></code></a> command run on Python installation:</p>
  466. <ul class="simple">
  467. <li><p><code class="docutils literal notranslate"><span class="pre">upgrade</span></code> (default): run <code class="docutils literal notranslate"><span class="pre">python</span> <span class="pre">-m</span> <span class="pre">ensurepip</span> <span class="pre">--altinstall</span> <span class="pre">--upgrade</span></code>
  468. command.</p></li>
  469. <li><p><code class="docutils literal notranslate"><span class="pre">install</span></code>: run <code class="docutils literal notranslate"><span class="pre">python</span> <span class="pre">-m</span> <span class="pre">ensurepip</span> <span class="pre">--altinstall</span></code> command;</p></li>
  470. <li><p><code class="docutils literal notranslate"><span class="pre">no</span></code>: don’t run ensurepip;</p></li>
  471. </ul>
  472. <div class="versionadded">
  473. <p><span class="versionmodified added">New in version 3.6.</span></p>
  474. </div>
  475. </dd></dl>
  476. </section>
  477. <section id="performance-options">
  478. <h3><span class="section-number">3.3.4. </span>Performance options<a class="headerlink" href="#performance-options" title="Link to this heading">¶</a></h3>
  479. <p>Configuring Python using <code class="docutils literal notranslate"><span class="pre">--enable-optimizations</span> <span class="pre">--with-lto</span></code> (PGO + LTO) is
  480. recommended for best performance. The experimental <code class="docutils literal notranslate"><span class="pre">--enable-bolt</span></code> flag can
  481. also be used to improve performance.</p>
  482. <dl class="std option">
  483. <dt class="sig sig-object std" id="cmdoption-enable-optimizations">
  484. <span class="sig-name descname"><span class="pre">--enable-optimizations</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-enable-optimizations" title="Link to this definition">¶</a></dt>
  485. <dd><p>Enable Profile Guided Optimization (PGO) using <span class="target" id="index-4"></span><a class="reference internal" href="#envvar-PROFILE_TASK"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">PROFILE_TASK</span></code></a>
  486. (disabled by default).</p>
  487. <p>The C compiler Clang requires <code class="docutils literal notranslate"><span class="pre">llvm-profdata</span></code> program for PGO. On
  488. macOS, GCC also requires it: GCC is just an alias to Clang on macOS.</p>
  489. <p>Disable also semantic interposition in libpython if <code class="docutils literal notranslate"><span class="pre">--enable-shared</span></code> and
  490. GCC is used: add <code class="docutils literal notranslate"><span class="pre">-fno-semantic-interposition</span></code> to the compiler and linker
  491. flags.</p>
  492. <div class="versionadded">
  493. <p><span class="versionmodified added">New in version 3.6.</span></p>
  494. </div>
  495. <div class="versionchanged">
  496. <p><span class="versionmodified changed">Changed in version 3.10: </span>Use <code class="docutils literal notranslate"><span class="pre">-fno-semantic-interposition</span></code> on GCC.</p>
  497. </div>
  498. </dd></dl>
  499. <dl class="std envvar">
  500. <dt class="sig sig-object std" id="envvar-PROFILE_TASK">
  501. <span class="sig-name descname"><span class="pre">PROFILE_TASK</span></span><a class="headerlink" href="#envvar-PROFILE_TASK" title="Link to this definition">¶</a></dt>
  502. <dd><p>Environment variable used in the Makefile: Python command line arguments for
  503. the PGO generation task.</p>
  504. <p>Default: <code class="docutils literal notranslate"><span class="pre">-m</span> <span class="pre">test</span> <span class="pre">--pgo</span> <span class="pre">--timeout=$(TESTTIMEOUT)</span></code>.</p>
  505. <div class="versionadded">
  506. <p><span class="versionmodified added">New in version 3.8.</span></p>
  507. </div>
  508. </dd></dl>
  509. <dl class="std option">
  510. <dt class="sig sig-object std" id="cmdoption-with-lto">
  511. <span class="sig-name descname"><span class="pre">--with-lto</span></span><span class="sig-prename descclassname"><span class="pre">=[full|thin|no|yes]</span></span><a class="headerlink" href="#cmdoption-with-lto" title="Link to this definition">¶</a></dt>
  512. <dd><p>Enable Link Time Optimization (LTO) in any build (disabled by default).</p>
  513. <p>The C compiler Clang requires <code class="docutils literal notranslate"><span class="pre">llvm-ar</span></code> for LTO (<code class="docutils literal notranslate"><span class="pre">ar</span></code> on macOS), as well
  514. as an LTO-aware linker (<code class="docutils literal notranslate"><span class="pre">ld.gold</span></code> or <code class="docutils literal notranslate"><span class="pre">lld</span></code>).</p>
  515. <div class="versionadded">
  516. <p><span class="versionmodified added">New in version 3.6.</span></p>
  517. </div>
  518. <div class="versionadded">
  519. <p><span class="versionmodified added">New in version 3.11: </span>To use ThinLTO feature, use <code class="docutils literal notranslate"><span class="pre">--with-lto=thin</span></code> on Clang.</p>
  520. </div>
  521. <div class="versionchanged">
  522. <p><span class="versionmodified changed">Changed in version 3.12: </span>Use ThinLTO as the default optimization policy on Clang if the compiler accepts the flag.</p>
  523. </div>
  524. </dd></dl>
  525. <dl class="std option">
  526. <dt class="sig sig-object std" id="cmdoption-enable-bolt">
  527. <span class="sig-name descname"><span class="pre">--enable-bolt</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-enable-bolt" title="Link to this definition">¶</a></dt>
  528. <dd><p>Enable usage of the <a class="reference external" href="https://github.com/llvm/llvm-project/tree/main/bolt">BOLT post-link binary optimizer</a> (disabled by
  529. default).</p>
  530. <p>BOLT is part of the LLVM project but is not always included in their binary
  531. distributions. This flag requires that <code class="docutils literal notranslate"><span class="pre">llvm-bolt</span></code> and <code class="docutils literal notranslate"><span class="pre">merge-fdata</span></code>
  532. are available.</p>
  533. <p>BOLT is still a fairly new project so this flag should be considered
  534. experimental for now. Because this tool operates on machine code its success
  535. is dependent on a combination of the build environment + the other
  536. optimization configure args + the CPU architecture, and not all combinations
  537. are supported.
  538. BOLT versions before LLVM 16 are known to crash BOLT under some scenarios.
  539. Use of LLVM 16 or newer for BOLT optimization is strongly encouraged.</p>
  540. <p>The <code class="xref std std-envvar docutils literal notranslate"><span class="pre">BOLT_INSTRUMENT_FLAGS</span></code> and <code class="xref std std-envvar docutils literal notranslate"><span class="pre">BOLT_APPLY_FLAGS</span></code>
  541. <strong class="program">configure</strong> variables can be defined to override the default set of
  542. arguments for <strong class="program">llvm-bolt</strong> to instrument and apply BOLT data to
  543. binaries, respectively.</p>
  544. <div class="versionadded">
  545. <p><span class="versionmodified added">New in version 3.12.</span></p>
  546. </div>
  547. </dd></dl>
  548. <dl class="std option">
  549. <dt class="sig sig-object std" id="cmdoption-with-computed-gotos">
  550. <span class="sig-name descname"><span class="pre">--with-computed-gotos</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-with-computed-gotos" title="Link to this definition">¶</a></dt>
  551. <dd><p>Enable computed gotos in evaluation loop (enabled by default on supported
  552. compilers).</p>
  553. </dd></dl>
  554. <dl class="std option">
  555. <dt class="sig sig-object std" id="cmdoption-without-pymalloc">
  556. <span class="sig-name descname"><span class="pre">--without-pymalloc</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-without-pymalloc" title="Link to this definition">¶</a></dt>
  557. <dd><p>Disable the specialized Python memory allocator <a class="reference internal" href="../c-api/memory.html#pymalloc"><span class="std std-ref">pymalloc</span></a>
  558. (enabled by default).</p>
  559. <p>See also <span class="target" id="index-5"></span><a class="reference internal" href="cmdline.html#envvar-PYTHONMALLOC"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">PYTHONMALLOC</span></code></a> environment variable.</p>
  560. </dd></dl>
  561. <dl class="std option">
  562. <dt class="sig sig-object std" id="cmdoption-without-doc-strings">
  563. <span class="sig-name descname"><span class="pre">--without-doc-strings</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-without-doc-strings" title="Link to this definition">¶</a></dt>
  564. <dd><p>Disable static documentation strings to reduce the memory footprint (enabled
  565. by default). Documentation strings defined in Python are not affected.</p>
  566. <p>Don’t define the <code class="docutils literal notranslate"><span class="pre">WITH_DOC_STRINGS</span></code> macro.</p>
  567. <p>See the <code class="docutils literal notranslate"><span class="pre">PyDoc_STRVAR()</span></code> macro.</p>
  568. </dd></dl>
  569. <dl class="std option">
  570. <dt class="sig sig-object std" id="cmdoption-enable-profiling">
  571. <span class="sig-name descname"><span class="pre">--enable-profiling</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-enable-profiling" title="Link to this definition">¶</a></dt>
  572. <dd><p>Enable C-level code profiling with <code class="docutils literal notranslate"><span class="pre">gprof</span></code> (disabled by default).</p>
  573. </dd></dl>
  574. <dl class="std option">
  575. <dt class="sig sig-object std" id="cmdoption-with-strict-overflow">
  576. <span class="sig-name descname"><span class="pre">--with-strict-overflow</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-with-strict-overflow" title="Link to this definition">¶</a></dt>
  577. <dd><p>Add <code class="docutils literal notranslate"><span class="pre">-fstrict-overflow</span></code> to the C compiler flags (by default we add
  578. <code class="docutils literal notranslate"><span class="pre">-fno-strict-overflow</span></code> instead).</p>
  579. </dd></dl>
  580. </section>
  581. <section id="python-debug-build">
  582. <span id="debug-build"></span><h3><span class="section-number">3.3.5. </span>Python Debug Build<a class="headerlink" href="#python-debug-build" title="Link to this heading">¶</a></h3>
  583. <p>A debug build is Python built with the <a class="reference internal" href="#cmdoption-with-pydebug"><code class="xref std std-option docutils literal notranslate"><span class="pre">--with-pydebug</span></code></a> configure
  584. option.</p>
  585. <p>Effects of a debug build:</p>
  586. <ul class="simple">
  587. <li><p>Display all warnings by default: the list of default warning filters is empty
  588. in the <a class="reference internal" href="../library/warnings.html#module-warnings" title="warnings: Issue warning messages and control their disposition."><code class="xref py py-mod docutils literal notranslate"><span class="pre">warnings</span></code></a> module.</p></li>
  589. <li><p>Add <code class="docutils literal notranslate"><span class="pre">d</span></code> to <a class="reference internal" href="../library/sys.html#sys.abiflags" title="sys.abiflags"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys.abiflags</span></code></a>.</p></li>
  590. <li><p>Add <code class="xref py py-func docutils literal notranslate"><span class="pre">sys.gettotalrefcount()</span></code> function.</p></li>
  591. <li><p>Add <a class="reference internal" href="cmdline.html#cmdoption-X"><code class="xref std std-option docutils literal notranslate"><span class="pre">-X</span> <span class="pre">showrefcount</span></code></a> command line option.</p></li>
  592. <li><p>Add <a class="reference internal" href="cmdline.html#cmdoption-d"><code class="xref std std-option docutils literal notranslate"><span class="pre">-d</span></code></a> command line option and <span class="target" id="index-6"></span><a class="reference internal" href="cmdline.html#envvar-PYTHONDEBUG"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">PYTHONDEBUG</span></code></a> environment
  593. variable to debug the parser.</p></li>
  594. <li><p>Add support for the <code class="docutils literal notranslate"><span class="pre">__lltrace__</span></code> variable: enable low-level tracing in the
  595. bytecode evaluation loop if the variable is defined.</p></li>
  596. <li><p>Install <a class="reference internal" href="../c-api/memory.html#default-memory-allocators"><span class="std std-ref">debug hooks on memory allocators</span></a>
  597. to detect buffer overflow and other memory errors.</p></li>
  598. <li><p>Define <code class="docutils literal notranslate"><span class="pre">Py_DEBUG</span></code> and <code class="docutils literal notranslate"><span class="pre">Py_REF_DEBUG</span></code> macros.</p></li>
  599. <li><p>Add runtime checks: code surrounded by <code class="docutils literal notranslate"><span class="pre">#ifdef</span> <span class="pre">Py_DEBUG</span></code> and <code class="docutils literal notranslate"><span class="pre">#endif</span></code>.
  600. Enable <code class="docutils literal notranslate"><span class="pre">assert(...)</span></code> and <code class="docutils literal notranslate"><span class="pre">_PyObject_ASSERT(...)</span></code> assertions: don’t set
  601. the <code class="docutils literal notranslate"><span class="pre">NDEBUG</span></code> macro (see also the <a class="reference internal" href="#cmdoption-with-assertions"><code class="xref std std-option docutils literal notranslate"><span class="pre">--with-assertions</span></code></a> configure
  602. option). Main runtime checks:</p>
  603. <ul>
  604. <li><p>Add sanity checks on the function arguments.</p></li>
  605. <li><p>Unicode and int objects are created with their memory filled with a pattern
  606. to detect usage of uninitialized objects.</p></li>
  607. <li><p>Ensure that functions which can clear or replace the current exception are
  608. not called with an exception raised.</p></li>
  609. <li><p>Check that deallocator functions don’t change the current exception.</p></li>
  610. <li><p>The garbage collector (<a class="reference internal" href="../library/gc.html#gc.collect" title="gc.collect"><code class="xref py py-func docutils literal notranslate"><span class="pre">gc.collect()</span></code></a> function) runs some basic checks
  611. on objects consistency.</p></li>
  612. <li><p>The <code class="xref c c-macro docutils literal notranslate"><span class="pre">Py_SAFE_DOWNCAST()</span></code> macro checks for integer underflow and
  613. overflow when downcasting from wide types to narrow types.</p></li>
  614. </ul>
  615. </li>
  616. </ul>
  617. <p>See also the <a class="reference internal" href="../library/devmode.html#devmode"><span class="std std-ref">Python Development Mode</span></a> and the
  618. <a class="reference internal" href="#cmdoption-with-trace-refs"><code class="xref std std-option docutils literal notranslate"><span class="pre">--with-trace-refs</span></code></a> configure option.</p>
  619. <div class="versionchanged">
  620. <p><span class="versionmodified changed">Changed in version 3.8: </span>Release builds and debug builds are now ABI compatible: defining the
  621. <code class="docutils literal notranslate"><span class="pre">Py_DEBUG</span></code> macro no longer implies the <code class="docutils literal notranslate"><span class="pre">Py_TRACE_REFS</span></code> macro (see the
  622. <a class="reference internal" href="#cmdoption-with-trace-refs"><code class="xref std std-option docutils literal notranslate"><span class="pre">--with-trace-refs</span></code></a> option), which introduces the only ABI
  623. incompatibility.</p>
  624. </div>
  625. </section>
  626. <section id="debug-options">
  627. <h3><span class="section-number">3.3.6. </span>Debug options<a class="headerlink" href="#debug-options" title="Link to this heading">¶</a></h3>
  628. <dl class="std option">
  629. <dt class="sig sig-object std" id="cmdoption-with-pydebug">
  630. <span class="sig-name descname"><span class="pre">--with-pydebug</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-with-pydebug" title="Link to this definition">¶</a></dt>
  631. <dd><p><a class="reference internal" href="#debug-build"><span class="std std-ref">Build Python in debug mode</span></a>: define the <code class="docutils literal notranslate"><span class="pre">Py_DEBUG</span></code>
  632. macro (disabled by default).</p>
  633. </dd></dl>
  634. <dl class="std option">
  635. <dt class="sig sig-object std" id="cmdoption-with-trace-refs">
  636. <span class="sig-name descname"><span class="pre">--with-trace-refs</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-with-trace-refs" title="Link to this definition">¶</a></dt>
  637. <dd><p>Enable tracing references for debugging purpose (disabled by default).</p>
  638. <p>Effects:</p>
  639. <ul class="simple">
  640. <li><p>Define the <code class="docutils literal notranslate"><span class="pre">Py_TRACE_REFS</span></code> macro.</p></li>
  641. <li><p>Add <code class="xref py py-func docutils literal notranslate"><span class="pre">sys.getobjects()</span></code> function.</p></li>
  642. <li><p>Add <span class="target" id="index-7"></span><a class="reference internal" href="cmdline.html#envvar-PYTHONDUMPREFS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">PYTHONDUMPREFS</span></code></a> environment variable.</p></li>
  643. </ul>
  644. <p>This build is not ABI compatible with release build (default build) or debug
  645. build (<code class="docutils literal notranslate"><span class="pre">Py_DEBUG</span></code> and <code class="docutils literal notranslate"><span class="pre">Py_REF_DEBUG</span></code> macros).</p>
  646. <div class="versionadded">
  647. <p><span class="versionmodified added">New in version 3.8.</span></p>
  648. </div>
  649. </dd></dl>
  650. <dl class="std option">
  651. <dt class="sig sig-object std" id="cmdoption-with-assertions">
  652. <span class="sig-name descname"><span class="pre">--with-assertions</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-with-assertions" title="Link to this definition">¶</a></dt>
  653. <dd><p>Build with C assertions enabled (default is no): <code class="docutils literal notranslate"><span class="pre">assert(...);</span></code> and
  654. <code class="docutils literal notranslate"><span class="pre">_PyObject_ASSERT(...);</span></code>.</p>
  655. <p>If set, the <code class="docutils literal notranslate"><span class="pre">NDEBUG</span></code> macro is not defined in the <span class="target" id="index-8"></span><a class="reference internal" href="#envvar-OPT"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">OPT</span></code></a> compiler
  656. variable.</p>
  657. <p>See also the <a class="reference internal" href="#cmdoption-with-pydebug"><code class="xref std std-option docutils literal notranslate"><span class="pre">--with-pydebug</span></code></a> option (<a class="reference internal" href="#debug-build"><span class="std std-ref">debug build</span></a>) which also enables assertions.</p>
  658. <div class="versionadded">
  659. <p><span class="versionmodified added">New in version 3.6.</span></p>
  660. </div>
  661. </dd></dl>
  662. <dl class="std option">
  663. <dt class="sig sig-object std" id="cmdoption-with-valgrind">
  664. <span class="sig-name descname"><span class="pre">--with-valgrind</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-with-valgrind" title="Link to this definition">¶</a></dt>
  665. <dd><p>Enable Valgrind support (default is no).</p>
  666. </dd></dl>
  667. <dl class="std option">
  668. <dt class="sig sig-object std" id="cmdoption-with-dtrace">
  669. <span class="sig-name descname"><span class="pre">--with-dtrace</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-with-dtrace" title="Link to this definition">¶</a></dt>
  670. <dd><p>Enable DTrace support (default is no).</p>
  671. <p>See <a class="reference internal" href="../howto/instrumentation.html#instrumentation"><span class="std std-ref">Instrumenting CPython with DTrace and SystemTap</span></a>.</p>
  672. <div class="versionadded">
  673. <p><span class="versionmodified added">New in version 3.6.</span></p>
  674. </div>
  675. </dd></dl>
  676. <dl class="std option">
  677. <dt class="sig sig-object std" id="cmdoption-with-address-sanitizer">
  678. <span class="sig-name descname"><span class="pre">--with-address-sanitizer</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-with-address-sanitizer" title="Link to this definition">¶</a></dt>
  679. <dd><p>Enable AddressSanitizer memory error detector, <code class="docutils literal notranslate"><span class="pre">asan</span></code> (default is no).</p>
  680. <div class="versionadded">
  681. <p><span class="versionmodified added">New in version 3.6.</span></p>
  682. </div>
  683. </dd></dl>
  684. <dl class="std option">
  685. <dt class="sig sig-object std" id="cmdoption-with-memory-sanitizer">
  686. <span class="sig-name descname"><span class="pre">--with-memory-sanitizer</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-with-memory-sanitizer" title="Link to this definition">¶</a></dt>
  687. <dd><p>Enable MemorySanitizer allocation error detector, <code class="docutils literal notranslate"><span class="pre">msan</span></code> (default is no).</p>
  688. <div class="versionadded">
  689. <p><span class="versionmodified added">New in version 3.6.</span></p>
  690. </div>
  691. </dd></dl>
  692. <dl class="std option">
  693. <dt class="sig sig-object std" id="cmdoption-with-undefined-behavior-sanitizer">
  694. <span class="sig-name descname"><span class="pre">--with-undefined-behavior-sanitizer</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-with-undefined-behavior-sanitizer" title="Link to this definition">¶</a></dt>
  695. <dd><p>Enable UndefinedBehaviorSanitizer undefined behaviour detector, <code class="docutils literal notranslate"><span class="pre">ubsan</span></code>
  696. (default is no).</p>
  697. <div class="versionadded">
  698. <p><span class="versionmodified added">New in version 3.6.</span></p>
  699. </div>
  700. </dd></dl>
  701. </section>
  702. <section id="linker-options">
  703. <h3><span class="section-number">3.3.7. </span>Linker options<a class="headerlink" href="#linker-options" title="Link to this heading">¶</a></h3>
  704. <dl class="std option">
  705. <dt class="sig sig-object std" id="cmdoption-enable-shared">
  706. <span class="sig-name descname"><span class="pre">--enable-shared</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-enable-shared" title="Link to this definition">¶</a></dt>
  707. <dd><p>Enable building a shared Python library: <code class="docutils literal notranslate"><span class="pre">libpython</span></code> (default is no).</p>
  708. </dd></dl>
  709. <dl class="std option">
  710. <dt class="sig sig-object std" id="cmdoption-without-static-libpython">
  711. <span class="sig-name descname"><span class="pre">--without-static-libpython</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-without-static-libpython" title="Link to this definition">¶</a></dt>
  712. <dd><p>Do not build <code class="docutils literal notranslate"><span class="pre">libpythonMAJOR.MINOR.a</span></code> and do not install <code class="docutils literal notranslate"><span class="pre">python.o</span></code>
  713. (built and enabled by default).</p>
  714. <div class="versionadded">
  715. <p><span class="versionmodified added">New in version 3.10.</span></p>
  716. </div>
  717. </dd></dl>
  718. </section>
  719. <section id="libraries-options">
  720. <h3><span class="section-number">3.3.8. </span>Libraries options<a class="headerlink" href="#libraries-options" title="Link to this heading">¶</a></h3>
  721. <dl class="std option">
  722. <dt class="sig sig-object std" id="cmdoption-with-libs">
  723. <span class="sig-name descname"><span class="pre">--with-libs</span></span><span class="sig-prename descclassname"><span class="pre">='lib1</span> <span class="pre">...'</span></span><a class="headerlink" href="#cmdoption-with-libs" title="Link to this definition">¶</a></dt>
  724. <dd><p>Link against additional libraries (default is no).</p>
  725. </dd></dl>
  726. <dl class="std option">
  727. <dt class="sig sig-object std" id="cmdoption-with-system-expat">
  728. <span class="sig-name descname"><span class="pre">--with-system-expat</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-with-system-expat" title="Link to this definition">¶</a></dt>
  729. <dd><p>Build the <code class="xref py py-mod docutils literal notranslate"><span class="pre">pyexpat</span></code> module using an installed <code class="docutils literal notranslate"><span class="pre">expat</span></code> library
  730. (default is no).</p>
  731. </dd></dl>
  732. <dl class="std option">
  733. <dt class="sig sig-object std" id="cmdoption-with-system-libmpdec">
  734. <span class="sig-name descname"><span class="pre">--with-system-libmpdec</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-with-system-libmpdec" title="Link to this definition">¶</a></dt>
  735. <dd><p>Build the <code class="docutils literal notranslate"><span class="pre">_decimal</span></code> extension module using an installed <code class="docutils literal notranslate"><span class="pre">mpdec</span></code>
  736. library, see the <a class="reference internal" href="../library/decimal.html#module-decimal" title="decimal: Implementation of the General Decimal Arithmetic Specification."><code class="xref py py-mod docutils literal notranslate"><span class="pre">decimal</span></code></a> module (default is no).</p>
  737. <div class="versionadded">
  738. <p><span class="versionmodified added">New in version 3.3.</span></p>
  739. </div>
  740. </dd></dl>
  741. <dl class="std option">
  742. <dt class="sig sig-object std" id="cmdoption-with-readline">
  743. <span class="sig-name descname"><span class="pre">--with-readline</span></span><span class="sig-prename descclassname"><span class="pre">=editline</span></span><a class="headerlink" href="#cmdoption-with-readline" title="Link to this definition">¶</a></dt>
  744. <dd><p>Use <code class="docutils literal notranslate"><span class="pre">editline</span></code> library for backend of the <a class="reference internal" href="../library/readline.html#module-readline" title="readline: GNU readline support for Python. (Unix)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">readline</span></code></a> module.</p>
  745. <p>Define the <code class="docutils literal notranslate"><span class="pre">WITH_EDITLINE</span></code> macro.</p>
  746. <div class="versionadded">
  747. <p><span class="versionmodified added">New in version 3.10.</span></p>
  748. </div>
  749. </dd></dl>
  750. <dl class="std option">
  751. <dt class="sig sig-object std" id="cmdoption-without-readline">
  752. <span class="sig-name descname"><span class="pre">--without-readline</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-without-readline" title="Link to this definition">¶</a></dt>
  753. <dd><p>Don’t build the <a class="reference internal" href="../library/readline.html#module-readline" title="readline: GNU readline support for Python. (Unix)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">readline</span></code></a> module (built by default).</p>
  754. <p>Don’t define the <code class="docutils literal notranslate"><span class="pre">HAVE_LIBREADLINE</span></code> macro.</p>
  755. <div class="versionadded">
  756. <p><span class="versionmodified added">New in version 3.10.</span></p>
  757. </div>
  758. </dd></dl>
  759. <dl class="std option">
  760. <dt class="sig sig-object std" id="cmdoption-with-libm">
  761. <span class="sig-name descname"><span class="pre">--with-libm</span></span><span class="sig-prename descclassname"><span class="pre">=STRING</span></span><a class="headerlink" href="#cmdoption-with-libm" title="Link to this definition">¶</a></dt>
  762. <dd><p>Override <code class="docutils literal notranslate"><span class="pre">libm</span></code> math library to <em>STRING</em> (default is system-dependent).</p>
  763. </dd></dl>
  764. <dl class="std option">
  765. <dt class="sig sig-object std" id="cmdoption-with-libc">
  766. <span class="sig-name descname"><span class="pre">--with-libc</span></span><span class="sig-prename descclassname"><span class="pre">=STRING</span></span><a class="headerlink" href="#cmdoption-with-libc" title="Link to this definition">¶</a></dt>
  767. <dd><p>Override <code class="docutils literal notranslate"><span class="pre">libc</span></code> C library to <em>STRING</em> (default is system-dependent).</p>
  768. </dd></dl>
  769. <dl class="std option">
  770. <dt class="sig sig-object std" id="cmdoption-with-openssl">
  771. <span class="sig-name descname"><span class="pre">--with-openssl</span></span><span class="sig-prename descclassname"><span class="pre">=DIR</span></span><a class="headerlink" href="#cmdoption-with-openssl" title="Link to this definition">¶</a></dt>
  772. <dd><p>Root of the OpenSSL directory.</p>
  773. <div class="versionadded">
  774. <p><span class="versionmodified added">New in version 3.7.</span></p>
  775. </div>
  776. </dd></dl>
  777. <dl class="std option">
  778. <dt class="sig sig-object std" id="cmdoption-with-openssl-rpath">
  779. <span class="sig-name descname"><span class="pre">--with-openssl-rpath</span></span><span class="sig-prename descclassname"><span class="pre">=[no|auto|DIR]</span></span><a class="headerlink" href="#cmdoption-with-openssl-rpath" title="Link to this definition">¶</a></dt>
  780. <dd><p>Set runtime library directory (rpath) for OpenSSL libraries:</p>
  781. <ul class="simple">
  782. <li><p><code class="docutils literal notranslate"><span class="pre">no</span></code> (default): don’t set rpath;</p></li>
  783. <li><p><code class="docutils literal notranslate"><span class="pre">auto</span></code>: auto-detect rpath from <a class="reference internal" href="#cmdoption-with-openssl"><code class="xref std std-option docutils literal notranslate"><span class="pre">--with-openssl</span></code></a> and
  784. <code class="docutils literal notranslate"><span class="pre">pkg-config</span></code>;</p></li>
  785. <li><p><em>DIR</em>: set an explicit rpath.</p></li>
  786. </ul>
  787. <div class="versionadded">
  788. <p><span class="versionmodified added">New in version 3.10.</span></p>
  789. </div>
  790. </dd></dl>
  791. </section>
  792. <section id="security-options">
  793. <h3><span class="section-number">3.3.9. </span>Security Options<a class="headerlink" href="#security-options" title="Link to this heading">¶</a></h3>
  794. <dl class="std option">
  795. <dt class="sig sig-object std" id="cmdoption-with-hash-algorithm">
  796. <span class="sig-name descname"><span class="pre">--with-hash-algorithm</span></span><span class="sig-prename descclassname"><span class="pre">=[fnv|siphash13|siphash24]</span></span><a class="headerlink" href="#cmdoption-with-hash-algorithm" title="Link to this definition">¶</a></dt>
  797. <dd><p>Select hash algorithm for use in <code class="docutils literal notranslate"><span class="pre">Python/pyhash.c</span></code>:</p>
  798. <ul class="simple">
  799. <li><p><code class="docutils literal notranslate"><span class="pre">siphash13</span></code> (default);</p></li>
  800. <li><p><code class="docutils literal notranslate"><span class="pre">siphash24</span></code>;</p></li>
  801. <li><p><code class="docutils literal notranslate"><span class="pre">fnv</span></code>.</p></li>
  802. </ul>
  803. <div class="versionadded">
  804. <p><span class="versionmodified added">New in version 3.4.</span></p>
  805. </div>
  806. <div class="versionadded">
  807. <p><span class="versionmodified added">New in version 3.11: </span><code class="docutils literal notranslate"><span class="pre">siphash13</span></code> is added and it is the new default.</p>
  808. </div>
  809. </dd></dl>
  810. <dl class="std option">
  811. <dt class="sig sig-object std" id="cmdoption-with-builtin-hashlib-hashes">
  812. <span class="sig-name descname"><span class="pre">--with-builtin-hashlib-hashes</span></span><span class="sig-prename descclassname"><span class="pre">=md5,sha1,sha256,sha512,sha3,blake2</span></span><a class="headerlink" href="#cmdoption-with-builtin-hashlib-hashes" title="Link to this definition">¶</a></dt>
  813. <dd><p>Built-in hash modules:</p>
  814. <ul class="simple">
  815. <li><p><code class="docutils literal notranslate"><span class="pre">md5</span></code>;</p></li>
  816. <li><p><code class="docutils literal notranslate"><span class="pre">sha1</span></code>;</p></li>
  817. <li><p><code class="docutils literal notranslate"><span class="pre">sha256</span></code>;</p></li>
  818. <li><p><code class="docutils literal notranslate"><span class="pre">sha512</span></code>;</p></li>
  819. <li><p><code class="docutils literal notranslate"><span class="pre">sha3</span></code> (with shake);</p></li>
  820. <li><p><code class="docutils literal notranslate"><span class="pre">blake2</span></code>.</p></li>
  821. </ul>
  822. <div class="versionadded">
  823. <p><span class="versionmodified added">New in version 3.9.</span></p>
  824. </div>
  825. </dd></dl>
  826. <dl class="std option">
  827. <dt class="sig sig-object std" id="cmdoption-with-ssl-default-suites">
  828. <span class="sig-name descname"><span class="pre">--with-ssl-default-suites</span></span><span class="sig-prename descclassname"><span class="pre">=[python|openssl|STRING]</span></span><a class="headerlink" href="#cmdoption-with-ssl-default-suites" title="Link to this definition">¶</a></dt>
  829. <dd><p>Override the OpenSSL default cipher suites string:</p>
  830. <ul class="simple">
  831. <li><p><code class="docutils literal notranslate"><span class="pre">python</span></code> (default): use Python’s preferred selection;</p></li>
  832. <li><p><code class="docutils literal notranslate"><span class="pre">openssl</span></code>: leave OpenSSL’s defaults untouched;</p></li>
  833. <li><p><em>STRING</em>: use a custom string</p></li>
  834. </ul>
  835. <p>See the <a class="reference internal" href="../library/ssl.html#module-ssl" title="ssl: TLS/SSL wrapper for socket objects"><code class="xref py py-mod docutils literal notranslate"><span class="pre">ssl</span></code></a> module.</p>
  836. <div class="versionadded">
  837. <p><span class="versionmodified added">New in version 3.7.</span></p>
  838. </div>
  839. <div class="versionchanged">
  840. <p><span class="versionmodified changed">Changed in version 3.10: </span>The settings <code class="docutils literal notranslate"><span class="pre">python</span></code> and <em>STRING</em> also set TLS 1.2 as minimum
  841. protocol version.</p>
  842. </div>
  843. </dd></dl>
  844. </section>
  845. <section id="macos-options">
  846. <h3><span class="section-number">3.3.10. </span>macOS Options<a class="headerlink" href="#macos-options" title="Link to this heading">¶</a></h3>
  847. <p>See <code class="docutils literal notranslate"><span class="pre">Mac/README.rst</span></code>.</p>
  848. <dl class="std option">
  849. <dt class="sig sig-object std" id="cmdoption-enable-universalsdk">
  850. <span class="sig-name descname"><span class="pre">--enable-universalsdk</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-enable-universalsdk" title="Link to this definition">¶</a></dt>
  851. <dd></dd></dl>
  852. <dl class="std option">
  853. <dt class="sig sig-object std" id="cmdoption-0">
  854. <span class="sig-name descname"><span class="pre">--enable-universalsdk</span></span><span class="sig-prename descclassname"><span class="pre">=SDKDIR</span></span><a class="headerlink" href="#cmdoption-0" title="Link to this definition">¶</a></dt>
  855. <dd><p>Create a universal binary build. <em>SDKDIR</em> specifies which macOS SDK should
  856. be used to perform the build (default is no).</p>
  857. </dd></dl>
  858. <dl class="std option">
  859. <dt class="sig sig-object std" id="cmdoption-enable-framework">
  860. <span class="sig-name descname"><span class="pre">--enable-framework</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-enable-framework" title="Link to this definition">¶</a></dt>
  861. <dd></dd></dl>
  862. <dl class="std option">
  863. <dt class="sig sig-object std" id="cmdoption-1">
  864. <span class="sig-name descname"><span class="pre">--enable-framework</span></span><span class="sig-prename descclassname"><span class="pre">=INSTALLDIR</span></span><a class="headerlink" href="#cmdoption-1" title="Link to this definition">¶</a></dt>
  865. <dd><p>Create a Python.framework rather than a traditional Unix install. Optional
  866. <em>INSTALLDIR</em> specifies the installation path (default is no).</p>
  867. </dd></dl>
  868. <dl class="std option">
  869. <dt class="sig sig-object std" id="cmdoption-with-universal-archs">
  870. <span class="sig-name descname"><span class="pre">--with-universal-archs</span></span><span class="sig-prename descclassname"><span class="pre">=ARCH</span></span><a class="headerlink" href="#cmdoption-with-universal-archs" title="Link to this definition">¶</a></dt>
  871. <dd><p>Specify the kind of universal binary that should be created. This option is
  872. only valid when <a class="reference internal" href="#cmdoption-enable-universalsdk"><code class="xref std std-option docutils literal notranslate"><span class="pre">--enable-universalsdk</span></code></a> is set.</p>
  873. <p>Options:</p>
  874. <ul class="simple">
  875. <li><p><code class="docutils literal notranslate"><span class="pre">universal2</span></code>;</p></li>
  876. <li><p><code class="docutils literal notranslate"><span class="pre">32-bit</span></code>;</p></li>
  877. <li><p><code class="docutils literal notranslate"><span class="pre">64-bit</span></code>;</p></li>
  878. <li><p><code class="docutils literal notranslate"><span class="pre">3-way</span></code>;</p></li>
  879. <li><p><code class="docutils literal notranslate"><span class="pre">intel</span></code>;</p></li>
  880. <li><p><code class="docutils literal notranslate"><span class="pre">intel-32</span></code>;</p></li>
  881. <li><p><code class="docutils literal notranslate"><span class="pre">intel-64</span></code>;</p></li>
  882. <li><p><code class="docutils literal notranslate"><span class="pre">all</span></code>.</p></li>
  883. </ul>
  884. </dd></dl>
  885. <dl class="std option">
  886. <dt class="sig sig-object std" id="cmdoption-with-framework-name">
  887. <span class="sig-name descname"><span class="pre">--with-framework-name</span></span><span class="sig-prename descclassname"><span class="pre">=FRAMEWORK</span></span><a class="headerlink" href="#cmdoption-with-framework-name" title="Link to this definition">¶</a></dt>
  888. <dd><p>Specify the name for the python framework on macOS only valid when
  889. <a class="reference internal" href="#cmdoption-enable-framework"><code class="xref std std-option docutils literal notranslate"><span class="pre">--enable-framework</span></code></a> is set (default: <code class="docutils literal notranslate"><span class="pre">Python</span></code>).</p>
  890. </dd></dl>
  891. </section>
  892. <section id="cross-compiling-options">
  893. <h3><span class="section-number">3.3.11. </span>Cross Compiling Options<a class="headerlink" href="#cross-compiling-options" title="Link to this heading">¶</a></h3>
  894. <p>Cross compiling, also known as cross building, can be used to build Python
  895. for another CPU architecture or platform. Cross compiling requires a Python
  896. interpreter for the build platform. The version of the build Python must match
  897. the version of the cross compiled host Python.</p>
  898. <dl class="std option">
  899. <dt class="sig sig-object std" id="cmdoption-build">
  900. <span class="sig-name descname"><span class="pre">--build</span></span><span class="sig-prename descclassname"><span class="pre">=BUILD</span></span><a class="headerlink" href="#cmdoption-build" title="Link to this definition">¶</a></dt>
  901. <dd><p>configure for building on BUILD, usually guessed by <strong class="program">config.guess</strong>.</p>
  902. </dd></dl>
  903. <dl class="std option">
  904. <dt class="sig sig-object std" id="cmdoption-host">
  905. <span class="sig-name descname"><span class="pre">--host</span></span><span class="sig-prename descclassname"><span class="pre">=HOST</span></span><a class="headerlink" href="#cmdoption-host" title="Link to this definition">¶</a></dt>
  906. <dd><p>cross-compile to build programs to run on HOST (target platform)</p>
  907. </dd></dl>
  908. <dl class="std option">
  909. <dt class="sig sig-object std" id="cmdoption-with-build-python">
  910. <span class="sig-name descname"><span class="pre">--with-build-python</span></span><span class="sig-prename descclassname"><span class="pre">=path/to/python</span></span><a class="headerlink" href="#cmdoption-with-build-python" title="Link to this definition">¶</a></dt>
  911. <dd><p>path to build <code class="docutils literal notranslate"><span class="pre">python</span></code> binary for cross compiling</p>
  912. <div class="versionadded">
  913. <p><span class="versionmodified added">New in version 3.11.</span></p>
  914. </div>
  915. </dd></dl>
  916. <dl class="std option">
  917. <dt class="sig sig-object std" id="cmdoption-arg-CONFIG_SITE">
  918. <span class="sig-name descname"><span class="pre">CONFIG_SITE</span></span><span class="sig-prename descclassname"><span class="pre">=file</span></span><a class="headerlink" href="#cmdoption-arg-CONFIG_SITE" title="Link to this definition">¶</a></dt>
  919. <dd><p>An environment variable that points to a file with configure overrides.</p>
  920. <p>Example <em>config.site</em> file:</p>
  921. <div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="c1"># config.site-aarch64</span>
  922. <span class="na">ac_cv_buggy_getaddrinfo</span><span class="o">=</span><span class="s">no</span>
  923. <span class="na">ac_cv_file__dev_ptmx</span><span class="o">=</span><span class="s">yes</span>
  924. <span class="na">ac_cv_file__dev_ptc</span><span class="o">=</span><span class="s">no</span>
  925. </pre></div>
  926. </div>
  927. </dd></dl>
  928. <p>Cross compiling example:</p>
  929. <div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="nv">CONFIG_SITE</span><span class="o">=</span>config.site-aarch64<span class="w"> </span>../configure<span class="w"> </span><span class="se">\</span>
  930. <span class="w"> </span>--build<span class="o">=</span>x86_64-pc-linux-gnu<span class="w"> </span><span class="se">\</span>
  931. <span class="w"> </span>--host<span class="o">=</span>aarch64-unknown-linux-gnu<span class="w"> </span><span class="se">\</span>
  932. <span class="w"> </span>--with-build-python<span class="o">=</span>../x86_64/python
  933. </pre></div>
  934. </div>
  935. </section>
  936. </section>
  937. <section id="python-build-system">
  938. <h2><span class="section-number">3.4. </span>Python Build System<a class="headerlink" href="#python-build-system" title="Link to this heading">¶</a></h2>
  939. <section id="main-files-of-the-build-system">
  940. <h3><span class="section-number">3.4.1. </span>Main files of the build system<a class="headerlink" href="#main-files-of-the-build-system" title="Link to this heading">¶</a></h3>
  941. <ul class="simple">
  942. <li><p><code class="file docutils literal notranslate"><span class="pre">configure.ac</span></code> =&gt; <code class="file docutils literal notranslate"><span class="pre">configure</span></code>;</p></li>
  943. <li><p><code class="file docutils literal notranslate"><span class="pre">Makefile.pre.in</span></code> =&gt; <code class="file docutils literal notranslate"><span class="pre">Makefile</span></code> (created by <code class="file docutils literal notranslate"><span class="pre">configure</span></code>);</p></li>
  944. <li><p><code class="file docutils literal notranslate"><span class="pre">pyconfig.h</span></code> (created by <code class="file docutils literal notranslate"><span class="pre">configure</span></code>);</p></li>
  945. <li><p><code class="file docutils literal notranslate"><span class="pre">Modules/Setup</span></code>: C extensions built by the Makefile using
  946. <code class="file docutils literal notranslate"><span class="pre">Module/makesetup</span></code> shell script;</p></li>
  947. </ul>
  948. </section>
  949. <section id="main-build-steps">
  950. <h3><span class="section-number">3.4.2. </span>Main build steps<a class="headerlink" href="#main-build-steps" title="Link to this heading">¶</a></h3>
  951. <ul class="simple">
  952. <li><p>C files (<code class="docutils literal notranslate"><span class="pre">.c</span></code>) are built as object files (<code class="docutils literal notranslate"><span class="pre">.o</span></code>).</p></li>
  953. <li><p>A static <code class="docutils literal notranslate"><span class="pre">libpython</span></code> library (<code class="docutils literal notranslate"><span class="pre">.a</span></code>) is created from objects files.</p></li>
  954. <li><p><code class="docutils literal notranslate"><span class="pre">python.o</span></code> and the static <code class="docutils literal notranslate"><span class="pre">libpython</span></code> library are linked into the
  955. final <code class="docutils literal notranslate"><span class="pre">python</span></code> program.</p></li>
  956. <li><p>C extensions are built by the Makefile (see <code class="file docutils literal notranslate"><span class="pre">Modules/Setup</span></code>).</p></li>
  957. </ul>
  958. </section>
  959. <section id="main-makefile-targets">
  960. <h3><span class="section-number">3.4.3. </span>Main Makefile targets<a class="headerlink" href="#main-makefile-targets" title="Link to this heading">¶</a></h3>
  961. <ul class="simple">
  962. <li><p><code class="docutils literal notranslate"><span class="pre">make</span></code>: Build Python with the standard library.</p></li>
  963. <li><p><code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">platform:</span></code>: build the <code class="docutils literal notranslate"><span class="pre">python</span></code> program, but don’t build the
  964. standard library extension modules.</p></li>
  965. <li><p><code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">profile-opt</span></code>: build Python using Profile Guided Optimization (PGO).
  966. You can use the configure <a class="reference internal" href="#cmdoption-enable-optimizations"><code class="xref std std-option docutils literal notranslate"><span class="pre">--enable-optimizations</span></code></a> option to make
  967. this the default target of the <code class="docutils literal notranslate"><span class="pre">make</span></code> command (<code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">all</span></code> or just
  968. <code class="docutils literal notranslate"><span class="pre">make</span></code>).</p></li>
  969. <li><p><code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">buildbottest</span></code>: Build Python and run the Python test suite, the same
  970. way than buildbots test Python. Set <code class="docutils literal notranslate"><span class="pre">TESTTIMEOUT</span></code> variable (in seconds)
  971. to change the test timeout (1200 by default: 20 minutes).</p></li>
  972. <li><p><code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">install</span></code>: Build and install Python.</p></li>
  973. <li><p><code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">regen-all</span></code>: Regenerate (almost) all generated files;
  974. <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">regen-stdlib-module-names</span></code> and <code class="docutils literal notranslate"><span class="pre">autoconf</span></code> must be run separately
  975. for the remaining generated files.</p></li>
  976. <li><p><code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">clean</span></code>: Remove built files.</p></li>
  977. <li><p><code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">distclean</span></code>: Same than <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">clean</span></code>, but remove also files created
  978. by the configure script.</p></li>
  979. </ul>
  980. </section>
  981. <section id="c-extensions">
  982. <h3><span class="section-number">3.4.4. </span>C extensions<a class="headerlink" href="#c-extensions" title="Link to this heading">¶</a></h3>
  983. <p>Some C extensions are built as built-in modules, like the <code class="docutils literal notranslate"><span class="pre">sys</span></code> module.
  984. They are built with the <code class="docutils literal notranslate"><span class="pre">Py_BUILD_CORE_BUILTIN</span></code> macro defined.
  985. Built-in modules have no <code class="docutils literal notranslate"><span class="pre">__file__</span></code> attribute:</p>
  986. <div class="highlight-pycon notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">sys</span>
  987. <span class="gp">&gt;&gt;&gt; </span><span class="n">sys</span>
  988. <span class="go">&lt;module &#39;sys&#39; (built-in)&gt;</span>
  989. <span class="gp">&gt;&gt;&gt; </span><span class="n">sys</span><span class="o">.</span><span class="vm">__file__</span>
  990. <span class="gt">Traceback (most recent call last):</span>
  991. File <span class="nb">&quot;&lt;stdin&gt;&quot;</span>, line <span class="m">1</span>, in <span class="n">&lt;module&gt;</span>
  992. <span class="gr">AttributeError</span>: <span class="n">module &#39;sys&#39; has no attribute &#39;__file__&#39;</span>
  993. </pre></div>
  994. </div>
  995. <p>Other C extensions are built as dynamic libraries, like the <code class="docutils literal notranslate"><span class="pre">_asyncio</span></code> module.
  996. They are built with the <code class="docutils literal notranslate"><span class="pre">Py_BUILD_CORE_MODULE</span></code> macro defined.
  997. Example on Linux x86-64:</p>
  998. <div class="highlight-pycon notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">_asyncio</span>
  999. <span class="gp">&gt;&gt;&gt; </span><span class="n">_asyncio</span>
  1000. <span class="go">&lt;module &#39;_asyncio&#39; from &#39;/usr/lib64/python3.9/lib-dynload/_asyncio.cpython-39-x86_64-linux-gnu.so&#39;&gt;</span>
  1001. <span class="gp">&gt;&gt;&gt; </span><span class="n">_asyncio</span><span class="o">.</span><span class="vm">__file__</span>
  1002. <span class="go">&#39;/usr/lib64/python3.9/lib-dynload/_asyncio.cpython-39-x86_64-linux-gnu.so&#39;</span>
  1003. </pre></div>
  1004. </div>
  1005. <p><code class="file docutils literal notranslate"><span class="pre">Modules/Setup</span></code> is used to generate Makefile targets to build C extensions.
  1006. At the beginning of the files, C extensions are built as built-in modules.
  1007. Extensions defined after the <code class="docutils literal notranslate"><span class="pre">*shared*</span></code> marker are built as dynamic libraries.</p>
  1008. <p>The <code class="xref c c-macro docutils literal notranslate"><span class="pre">PyAPI_FUNC()</span></code>, <code class="xref c c-macro docutils literal notranslate"><span class="pre">PyAPI_DATA()</span></code> and
  1009. <a class="reference internal" href="../c-api/intro.html#c.PyMODINIT_FUNC" title="PyMODINIT_FUNC"><code class="xref c c-macro docutils literal notranslate"><span class="pre">PyMODINIT_FUNC</span></code></a> macros of <code class="file docutils literal notranslate"><span class="pre">Include/exports.h</span></code> are defined
  1010. differently depending if the <code class="docutils literal notranslate"><span class="pre">Py_BUILD_CORE_MODULE</span></code> macro is defined:</p>
  1011. <ul class="simple">
  1012. <li><p>Use <code class="docutils literal notranslate"><span class="pre">Py_EXPORTED_SYMBOL</span></code> if the <code class="docutils literal notranslate"><span class="pre">Py_BUILD_CORE_MODULE</span></code> is defined</p></li>
  1013. <li><p>Use <code class="docutils literal notranslate"><span class="pre">Py_IMPORTED_SYMBOL</span></code> otherwise.</p></li>
  1014. </ul>
  1015. <p>If the <code class="docutils literal notranslate"><span class="pre">Py_BUILD_CORE_BUILTIN</span></code> macro is used by mistake on a C extension
  1016. built as a shared library, its <code class="samp docutils literal notranslate"><span class="pre">PyInit_</span><em><span class="pre">xxx</span></em><span class="pre">()</span></code> function is not exported,
  1017. causing an <a class="reference internal" href="../library/exceptions.html#ImportError" title="ImportError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ImportError</span></code></a> on import.</p>
  1018. </section>
  1019. </section>
  1020. <section id="compiler-and-linker-flags">
  1021. <h2><span class="section-number">3.5. </span>Compiler and linker flags<a class="headerlink" href="#compiler-and-linker-flags" title="Link to this heading">¶</a></h2>
  1022. <p>Options set by the <code class="docutils literal notranslate"><span class="pre">./configure</span></code> script and environment variables and used by
  1023. <code class="docutils literal notranslate"><span class="pre">Makefile</span></code>.</p>
  1024. <section id="preprocessor-flags">
  1025. <h3><span class="section-number">3.5.1. </span>Preprocessor flags<a class="headerlink" href="#preprocessor-flags" title="Link to this heading">¶</a></h3>
  1026. <dl class="std envvar">
  1027. <dt class="sig sig-object std" id="envvar-CONFIGURE_CPPFLAGS">
  1028. <span class="sig-name descname"><span class="pre">CONFIGURE_CPPFLAGS</span></span><a class="headerlink" href="#envvar-CONFIGURE_CPPFLAGS" title="Link to this definition">¶</a></dt>
  1029. <dd><p>Value of <span class="target" id="index-9"></span><a class="reference internal" href="#envvar-CPPFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">CPPFLAGS</span></code></a> variable passed to the <code class="docutils literal notranslate"><span class="pre">./configure</span></code> script.</p>
  1030. <div class="versionadded">
  1031. <p><span class="versionmodified added">New in version 3.6.</span></p>
  1032. </div>
  1033. </dd></dl>
  1034. <dl class="std envvar">
  1035. <dt class="sig sig-object std" id="envvar-CPPFLAGS">
  1036. <span class="sig-name descname"><span class="pre">CPPFLAGS</span></span><a class="headerlink" href="#envvar-CPPFLAGS" title="Link to this definition">¶</a></dt>
  1037. <dd><p>(Objective) C/C++ preprocessor flags, e.g. <code class="samp docutils literal notranslate"><span class="pre">-I</span><em><span class="pre">include_dir</span></em></code> if you have
  1038. headers in a nonstandard directory <em>include_dir</em>.</p>
  1039. <p>Both <span class="target" id="index-10"></span><a class="reference internal" href="#envvar-CPPFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">CPPFLAGS</span></code></a> and <span class="target" id="index-11"></span><a class="reference internal" href="#envvar-LDFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">LDFLAGS</span></code></a> need to contain the shell’s
  1040. value to be able to build extension modules using the
  1041. directories specified in the environment variables.</p>
  1042. </dd></dl>
  1043. <dl class="std envvar">
  1044. <dt class="sig sig-object std" id="envvar-BASECPPFLAGS">
  1045. <span class="sig-name descname"><span class="pre">BASECPPFLAGS</span></span><a class="headerlink" href="#envvar-BASECPPFLAGS" title="Link to this definition">¶</a></dt>
  1046. <dd><div class="versionadded">
  1047. <p><span class="versionmodified added">New in version 3.4.</span></p>
  1048. </div>
  1049. </dd></dl>
  1050. <dl class="std envvar">
  1051. <dt class="sig sig-object std" id="envvar-PY_CPPFLAGS">
  1052. <span class="sig-name descname"><span class="pre">PY_CPPFLAGS</span></span><a class="headerlink" href="#envvar-PY_CPPFLAGS" title="Link to this definition">¶</a></dt>
  1053. <dd><p>Extra preprocessor flags added for building the interpreter object files.</p>
  1054. <p>Default: <code class="docutils literal notranslate"><span class="pre">$(BASECPPFLAGS)</span> <span class="pre">-I.</span> <span class="pre">-I$(srcdir)/Include</span> <span class="pre">$(CONFIGURE_CPPFLAGS)</span> <span class="pre">$(CPPFLAGS)</span></code>.</p>
  1055. <div class="versionadded">
  1056. <p><span class="versionmodified added">New in version 3.2.</span></p>
  1057. </div>
  1058. </dd></dl>
  1059. </section>
  1060. <section id="compiler-flags">
  1061. <h3><span class="section-number">3.5.2. </span>Compiler flags<a class="headerlink" href="#compiler-flags" title="Link to this heading">¶</a></h3>
  1062. <dl class="std envvar">
  1063. <dt class="sig sig-object std" id="envvar-CC">
  1064. <span class="sig-name descname"><span class="pre">CC</span></span><a class="headerlink" href="#envvar-CC" title="Link to this definition">¶</a></dt>
  1065. <dd><p>C compiler command.</p>
  1066. <p>Example: <code class="docutils literal notranslate"><span class="pre">gcc</span> <span class="pre">-pthread</span></code>.</p>
  1067. </dd></dl>
  1068. <dl class="std envvar">
  1069. <dt class="sig sig-object std" id="envvar-CXX">
  1070. <span class="sig-name descname"><span class="pre">CXX</span></span><a class="headerlink" href="#envvar-CXX" title="Link to this definition">¶</a></dt>
  1071. <dd><p>C++ compiler command.</p>
  1072. <p>Example: <code class="docutils literal notranslate"><span class="pre">g++</span> <span class="pre">-pthread</span></code>.</p>
  1073. </dd></dl>
  1074. <dl class="std envvar">
  1075. <dt class="sig sig-object std" id="envvar-CFLAGS">
  1076. <span class="sig-name descname"><span class="pre">CFLAGS</span></span><a class="headerlink" href="#envvar-CFLAGS" title="Link to this definition">¶</a></dt>
  1077. <dd><p>C compiler flags.</p>
  1078. </dd></dl>
  1079. <dl class="std envvar">
  1080. <dt class="sig sig-object std" id="envvar-CFLAGS_NODIST">
  1081. <span class="sig-name descname"><span class="pre">CFLAGS_NODIST</span></span><a class="headerlink" href="#envvar-CFLAGS_NODIST" title="Link to this definition">¶</a></dt>
  1082. <dd><p><span class="target" id="index-12"></span><a class="reference internal" href="#envvar-CFLAGS_NODIST"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">CFLAGS_NODIST</span></code></a> is used for building the interpreter and stdlib C
  1083. extensions. Use it when a compiler flag should <em>not</em> be part of
  1084. <span class="target" id="index-13"></span><a class="reference internal" href="#envvar-CFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">CFLAGS</span></code></a> once Python is installed (<a class="reference external" href="https://github.com/python/cpython/issues/65320">gh-65320</a>).</p>
  1085. <p>In particular, <span class="target" id="index-14"></span><a class="reference internal" href="#envvar-CFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">CFLAGS</span></code></a> should not contain:</p>
  1086. <ul class="simple">
  1087. <li><p>the compiler flag <code class="docutils literal notranslate"><span class="pre">-I</span></code> (for setting the search path for include files).
  1088. The <code class="docutils literal notranslate"><span class="pre">-I</span></code> flags are processed from left to right, and any flags in
  1089. <span class="target" id="index-15"></span><a class="reference internal" href="#envvar-CFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">CFLAGS</span></code></a> would take precedence over user- and package-supplied <code class="docutils literal notranslate"><span class="pre">-I</span></code>
  1090. flags.</p></li>
  1091. <li><p>hardening flags such as <code class="docutils literal notranslate"><span class="pre">-Werror</span></code> because distributions cannot control
  1092. whether packages installed by users conform to such heightened
  1093. standards.</p></li>
  1094. </ul>
  1095. <div class="versionadded">
  1096. <p><span class="versionmodified added">New in version 3.5.</span></p>
  1097. </div>
  1098. </dd></dl>
  1099. <dl class="std envvar">
  1100. <dt class="sig sig-object std" id="envvar-COMPILEALL_OPTS">
  1101. <span class="sig-name descname"><span class="pre">COMPILEALL_OPTS</span></span><a class="headerlink" href="#envvar-COMPILEALL_OPTS" title="Link to this definition">¶</a></dt>
  1102. <dd><p>Options passed to the <a class="reference internal" href="../library/compileall.html#module-compileall" title="compileall: Tools for byte-compiling all Python source files in a directory tree."><code class="xref py py-mod docutils literal notranslate"><span class="pre">compileall</span></code></a> command line when building PYC files
  1103. in <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">install</span></code>. Default: <code class="docutils literal notranslate"><span class="pre">-j0</span></code>.</p>
  1104. <div class="versionadded">
  1105. <p><span class="versionmodified added">New in version 3.12.</span></p>
  1106. </div>
  1107. </dd></dl>
  1108. <dl class="std envvar">
  1109. <dt class="sig sig-object std" id="envvar-EXTRA_CFLAGS">
  1110. <span class="sig-name descname"><span class="pre">EXTRA_CFLAGS</span></span><a class="headerlink" href="#envvar-EXTRA_CFLAGS" title="Link to this definition">¶</a></dt>
  1111. <dd><p>Extra C compiler flags.</p>
  1112. </dd></dl>
  1113. <dl class="std envvar">
  1114. <dt class="sig sig-object std" id="envvar-CONFIGURE_CFLAGS">
  1115. <span class="sig-name descname"><span class="pre">CONFIGURE_CFLAGS</span></span><a class="headerlink" href="#envvar-CONFIGURE_CFLAGS" title="Link to this definition">¶</a></dt>
  1116. <dd><p>Value of <span class="target" id="index-16"></span><a class="reference internal" href="#envvar-CFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">CFLAGS</span></code></a> variable passed to the <code class="docutils literal notranslate"><span class="pre">./configure</span></code>
  1117. script.</p>
  1118. <div class="versionadded">
  1119. <p><span class="versionmodified added">New in version 3.2.</span></p>
  1120. </div>
  1121. </dd></dl>
  1122. <dl class="std envvar">
  1123. <dt class="sig sig-object std" id="envvar-CONFIGURE_CFLAGS_NODIST">
  1124. <span class="sig-name descname"><span class="pre">CONFIGURE_CFLAGS_NODIST</span></span><a class="headerlink" href="#envvar-CONFIGURE_CFLAGS_NODIST" title="Link to this definition">¶</a></dt>
  1125. <dd><p>Value of <span class="target" id="index-17"></span><a class="reference internal" href="#envvar-CFLAGS_NODIST"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">CFLAGS_NODIST</span></code></a> variable passed to the <code class="docutils literal notranslate"><span class="pre">./configure</span></code>
  1126. script.</p>
  1127. <div class="versionadded">
  1128. <p><span class="versionmodified added">New in version 3.5.</span></p>
  1129. </div>
  1130. </dd></dl>
  1131. <dl class="std envvar">
  1132. <dt class="sig sig-object std" id="envvar-BASECFLAGS">
  1133. <span class="sig-name descname"><span class="pre">BASECFLAGS</span></span><a class="headerlink" href="#envvar-BASECFLAGS" title="Link to this definition">¶</a></dt>
  1134. <dd><p>Base compiler flags.</p>
  1135. </dd></dl>
  1136. <dl class="std envvar">
  1137. <dt class="sig sig-object std" id="envvar-OPT">
  1138. <span class="sig-name descname"><span class="pre">OPT</span></span><a class="headerlink" href="#envvar-OPT" title="Link to this definition">¶</a></dt>
  1139. <dd><p>Optimization flags.</p>
  1140. </dd></dl>
  1141. <dl class="std envvar">
  1142. <dt class="sig sig-object std" id="envvar-CFLAGS_ALIASING">
  1143. <span class="sig-name descname"><span class="pre">CFLAGS_ALIASING</span></span><a class="headerlink" href="#envvar-CFLAGS_ALIASING" title="Link to this definition">¶</a></dt>
  1144. <dd><p>Strict or non-strict aliasing flags used to compile <code class="docutils literal notranslate"><span class="pre">Python/dtoa.c</span></code>.</p>
  1145. <div class="versionadded">
  1146. <p><span class="versionmodified added">New in version 3.7.</span></p>
  1147. </div>
  1148. </dd></dl>
  1149. <dl class="std envvar">
  1150. <dt class="sig sig-object std" id="envvar-CCSHARED">
  1151. <span class="sig-name descname"><span class="pre">CCSHARED</span></span><a class="headerlink" href="#envvar-CCSHARED" title="Link to this definition">¶</a></dt>
  1152. <dd><p>Compiler flags used to build a shared library.</p>
  1153. <p>For example, <code class="docutils literal notranslate"><span class="pre">-fPIC</span></code> is used on Linux and on BSD.</p>
  1154. </dd></dl>
  1155. <dl class="std envvar">
  1156. <dt class="sig sig-object std" id="envvar-CFLAGSFORSHARED">
  1157. <span class="sig-name descname"><span class="pre">CFLAGSFORSHARED</span></span><a class="headerlink" href="#envvar-CFLAGSFORSHARED" title="Link to this definition">¶</a></dt>
  1158. <dd><p>Extra C flags added for building the interpreter object files.</p>
  1159. <p>Default: <code class="docutils literal notranslate"><span class="pre">$(CCSHARED)</span></code> when <a class="reference internal" href="#cmdoption-enable-shared"><code class="xref std std-option docutils literal notranslate"><span class="pre">--enable-shared</span></code></a> is used, or an empty
  1160. string otherwise.</p>
  1161. </dd></dl>
  1162. <dl class="std envvar">
  1163. <dt class="sig sig-object std" id="envvar-PY_CFLAGS">
  1164. <span class="sig-name descname"><span class="pre">PY_CFLAGS</span></span><a class="headerlink" href="#envvar-PY_CFLAGS" title="Link to this definition">¶</a></dt>
  1165. <dd><p>Default: <code class="docutils literal notranslate"><span class="pre">$(BASECFLAGS)</span> <span class="pre">$(OPT)</span> <span class="pre">$(CONFIGURE_CFLAGS)</span> <span class="pre">$(CFLAGS)</span> <span class="pre">$(EXTRA_CFLAGS)</span></code>.</p>
  1166. </dd></dl>
  1167. <dl class="std envvar">
  1168. <dt class="sig sig-object std" id="envvar-PY_CFLAGS_NODIST">
  1169. <span class="sig-name descname"><span class="pre">PY_CFLAGS_NODIST</span></span><a class="headerlink" href="#envvar-PY_CFLAGS_NODIST" title="Link to this definition">¶</a></dt>
  1170. <dd><p>Default: <code class="docutils literal notranslate"><span class="pre">$(CONFIGURE_CFLAGS_NODIST)</span> <span class="pre">$(CFLAGS_NODIST)</span> <span class="pre">-I$(srcdir)/Include/internal</span></code>.</p>
  1171. <div class="versionadded">
  1172. <p><span class="versionmodified added">New in version 3.5.</span></p>
  1173. </div>
  1174. </dd></dl>
  1175. <dl class="std envvar">
  1176. <dt class="sig sig-object std" id="envvar-PY_STDMODULE_CFLAGS">
  1177. <span class="sig-name descname"><span class="pre">PY_STDMODULE_CFLAGS</span></span><a class="headerlink" href="#envvar-PY_STDMODULE_CFLAGS" title="Link to this definition">¶</a></dt>
  1178. <dd><p>C flags used for building the interpreter object files.</p>
  1179. <p>Default: <code class="docutils literal notranslate"><span class="pre">$(PY_CFLAGS)</span> <span class="pre">$(PY_CFLAGS_NODIST)</span> <span class="pre">$(PY_CPPFLAGS)</span> <span class="pre">$(CFLAGSFORSHARED)</span></code>.</p>
  1180. <div class="versionadded">
  1181. <p><span class="versionmodified added">New in version 3.7.</span></p>
  1182. </div>
  1183. </dd></dl>
  1184. <dl class="std envvar">
  1185. <dt class="sig sig-object std" id="envvar-PY_CORE_CFLAGS">
  1186. <span class="sig-name descname"><span class="pre">PY_CORE_CFLAGS</span></span><a class="headerlink" href="#envvar-PY_CORE_CFLAGS" title="Link to this definition">¶</a></dt>
  1187. <dd><p>Default: <code class="docutils literal notranslate"><span class="pre">$(PY_STDMODULE_CFLAGS)</span> <span class="pre">-DPy_BUILD_CORE</span></code>.</p>
  1188. <div class="versionadded">
  1189. <p><span class="versionmodified added">New in version 3.2.</span></p>
  1190. </div>
  1191. </dd></dl>
  1192. <dl class="std envvar">
  1193. <dt class="sig sig-object std" id="envvar-PY_BUILTIN_MODULE_CFLAGS">
  1194. <span class="sig-name descname"><span class="pre">PY_BUILTIN_MODULE_CFLAGS</span></span><a class="headerlink" href="#envvar-PY_BUILTIN_MODULE_CFLAGS" title="Link to this definition">¶</a></dt>
  1195. <dd><p>Compiler flags to build a standard library extension module as a built-in
  1196. module, like the <a class="reference internal" href="../library/posix.html#module-posix" title="posix: The most common POSIX system calls (normally used via module os). (Unix)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">posix</span></code></a> module.</p>
  1197. <p>Default: <code class="docutils literal notranslate"><span class="pre">$(PY_STDMODULE_CFLAGS)</span> <span class="pre">-DPy_BUILD_CORE_BUILTIN</span></code>.</p>
  1198. <div class="versionadded">
  1199. <p><span class="versionmodified added">New in version 3.8.</span></p>
  1200. </div>
  1201. </dd></dl>
  1202. <dl class="std envvar">
  1203. <dt class="sig sig-object std" id="envvar-PURIFY">
  1204. <span class="sig-name descname"><span class="pre">PURIFY</span></span><a class="headerlink" href="#envvar-PURIFY" title="Link to this definition">¶</a></dt>
  1205. <dd><p>Purify command. Purify is a memory debugger program.</p>
  1206. <p>Default: empty string (not used).</p>
  1207. </dd></dl>
  1208. </section>
  1209. <section id="linker-flags">
  1210. <h3><span class="section-number">3.5.3. </span>Linker flags<a class="headerlink" href="#linker-flags" title="Link to this heading">¶</a></h3>
  1211. <dl class="std envvar">
  1212. <dt class="sig sig-object std" id="envvar-LINKCC">
  1213. <span class="sig-name descname"><span class="pre">LINKCC</span></span><a class="headerlink" href="#envvar-LINKCC" title="Link to this definition">¶</a></dt>
  1214. <dd><p>Linker command used to build programs like <code class="docutils literal notranslate"><span class="pre">python</span></code> and <code class="docutils literal notranslate"><span class="pre">_testembed</span></code>.</p>
  1215. <p>Default: <code class="docutils literal notranslate"><span class="pre">$(PURIFY)</span> <span class="pre">$(CC)</span></code>.</p>
  1216. </dd></dl>
  1217. <dl class="std envvar">
  1218. <dt class="sig sig-object std" id="envvar-CONFIGURE_LDFLAGS">
  1219. <span class="sig-name descname"><span class="pre">CONFIGURE_LDFLAGS</span></span><a class="headerlink" href="#envvar-CONFIGURE_LDFLAGS" title="Link to this definition">¶</a></dt>
  1220. <dd><p>Value of <span class="target" id="index-18"></span><a class="reference internal" href="#envvar-LDFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">LDFLAGS</span></code></a> variable passed to the <code class="docutils literal notranslate"><span class="pre">./configure</span></code> script.</p>
  1221. <p>Avoid assigning <span class="target" id="index-19"></span><a class="reference internal" href="#envvar-CFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">CFLAGS</span></code></a>, <span class="target" id="index-20"></span><a class="reference internal" href="#envvar-LDFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">LDFLAGS</span></code></a>, etc. so users can use
  1222. them on the command line to append to these values without stomping the
  1223. pre-set values.</p>
  1224. <div class="versionadded">
  1225. <p><span class="versionmodified added">New in version 3.2.</span></p>
  1226. </div>
  1227. </dd></dl>
  1228. <dl class="std envvar">
  1229. <dt class="sig sig-object std" id="envvar-LDFLAGS_NODIST">
  1230. <span class="sig-name descname"><span class="pre">LDFLAGS_NODIST</span></span><a class="headerlink" href="#envvar-LDFLAGS_NODIST" title="Link to this definition">¶</a></dt>
  1231. <dd><p><span class="target" id="index-21"></span><a class="reference internal" href="#envvar-LDFLAGS_NODIST"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">LDFLAGS_NODIST</span></code></a> is used in the same manner as
  1232. <span class="target" id="index-22"></span><a class="reference internal" href="#envvar-CFLAGS_NODIST"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">CFLAGS_NODIST</span></code></a>. Use it when a linker flag should <em>not</em> be part of
  1233. <span class="target" id="index-23"></span><a class="reference internal" href="#envvar-LDFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">LDFLAGS</span></code></a> once Python is installed (<a class="reference external" href="https://github.com/python/cpython/issues/65320">gh-65320</a>).</p>
  1234. <p>In particular, <span class="target" id="index-24"></span><a class="reference internal" href="#envvar-LDFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">LDFLAGS</span></code></a> should not contain:</p>
  1235. <ul class="simple">
  1236. <li><p>the compiler flag <code class="docutils literal notranslate"><span class="pre">-L</span></code> (for setting the search path for libraries).
  1237. The <code class="docutils literal notranslate"><span class="pre">-L</span></code> flags are processed from left to right, and any flags in
  1238. <span class="target" id="index-25"></span><a class="reference internal" href="#envvar-LDFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">LDFLAGS</span></code></a> would take precedence over user- and package-supplied <code class="docutils literal notranslate"><span class="pre">-L</span></code>
  1239. flags.</p></li>
  1240. </ul>
  1241. </dd></dl>
  1242. <dl class="std envvar">
  1243. <dt class="sig sig-object std" id="envvar-CONFIGURE_LDFLAGS_NODIST">
  1244. <span class="sig-name descname"><span class="pre">CONFIGURE_LDFLAGS_NODIST</span></span><a class="headerlink" href="#envvar-CONFIGURE_LDFLAGS_NODIST" title="Link to this definition">¶</a></dt>
  1245. <dd><p>Value of <span class="target" id="index-26"></span><a class="reference internal" href="#envvar-LDFLAGS_NODIST"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">LDFLAGS_NODIST</span></code></a> variable passed to the <code class="docutils literal notranslate"><span class="pre">./configure</span></code>
  1246. script.</p>
  1247. <div class="versionadded">
  1248. <p><span class="versionmodified added">New in version 3.8.</span></p>
  1249. </div>
  1250. </dd></dl>
  1251. <dl class="std envvar">
  1252. <dt class="sig sig-object std" id="envvar-LDFLAGS">
  1253. <span class="sig-name descname"><span class="pre">LDFLAGS</span></span><a class="headerlink" href="#envvar-LDFLAGS" title="Link to this definition">¶</a></dt>
  1254. <dd><p>Linker flags, e.g. <code class="samp docutils literal notranslate"><span class="pre">-L</span><em><span class="pre">lib_dir</span></em></code> if you have libraries in a nonstandard
  1255. directory <em>lib_dir</em>.</p>
  1256. <p>Both <span class="target" id="index-27"></span><a class="reference internal" href="#envvar-CPPFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">CPPFLAGS</span></code></a> and <span class="target" id="index-28"></span><a class="reference internal" href="#envvar-LDFLAGS"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">LDFLAGS</span></code></a> need to contain the shell’s
  1257. value to be able to build extension modules using the
  1258. directories specified in the environment variables.</p>
  1259. </dd></dl>
  1260. <dl class="std envvar">
  1261. <dt class="sig sig-object std" id="envvar-LIBS">
  1262. <span class="sig-name descname"><span class="pre">LIBS</span></span><a class="headerlink" href="#envvar-LIBS" title="Link to this definition">¶</a></dt>
  1263. <dd><p>Linker flags to pass libraries to the linker when linking the Python
  1264. executable.</p>
  1265. <p>Example: <code class="docutils literal notranslate"><span class="pre">-lrt</span></code>.</p>
  1266. </dd></dl>
  1267. <dl class="std envvar">
  1268. <dt class="sig sig-object std" id="envvar-LDSHARED">
  1269. <span class="sig-name descname"><span class="pre">LDSHARED</span></span><a class="headerlink" href="#envvar-LDSHARED" title="Link to this definition">¶</a></dt>
  1270. <dd><p>Command to build a shared library.</p>
  1271. <p>Default: <code class="docutils literal notranslate"><span class="pre">&#64;LDSHARED&#64;</span> <span class="pre">$(PY_LDFLAGS)</span></code>.</p>
  1272. </dd></dl>
  1273. <dl class="std envvar">
  1274. <dt class="sig sig-object std" id="envvar-BLDSHARED">
  1275. <span class="sig-name descname"><span class="pre">BLDSHARED</span></span><a class="headerlink" href="#envvar-BLDSHARED" title="Link to this definition">¶</a></dt>
  1276. <dd><p>Command to build <code class="docutils literal notranslate"><span class="pre">libpython</span></code> shared library.</p>
  1277. <p>Default: <code class="docutils literal notranslate"><span class="pre">&#64;BLDSHARED&#64;</span> <span class="pre">$(PY_CORE_LDFLAGS)</span></code>.</p>
  1278. </dd></dl>
  1279. <dl class="std envvar">
  1280. <dt class="sig sig-object std" id="envvar-PY_LDFLAGS">
  1281. <span class="sig-name descname"><span class="pre">PY_LDFLAGS</span></span><a class="headerlink" href="#envvar-PY_LDFLAGS" title="Link to this definition">¶</a></dt>
  1282. <dd><p>Default: <code class="docutils literal notranslate"><span class="pre">$(CONFIGURE_LDFLAGS)</span> <span class="pre">$(LDFLAGS)</span></code>.</p>
  1283. </dd></dl>
  1284. <dl class="std envvar">
  1285. <dt class="sig sig-object std" id="envvar-PY_LDFLAGS_NODIST">
  1286. <span class="sig-name descname"><span class="pre">PY_LDFLAGS_NODIST</span></span><a class="headerlink" href="#envvar-PY_LDFLAGS_NODIST" title="Link to this definition">¶</a></dt>
  1287. <dd><p>Default: <code class="docutils literal notranslate"><span class="pre">$(CONFIGURE_LDFLAGS_NODIST)</span> <span class="pre">$(LDFLAGS_NODIST)</span></code>.</p>
  1288. <div class="versionadded">
  1289. <p><span class="versionmodified added">New in version 3.8.</span></p>
  1290. </div>
  1291. </dd></dl>
  1292. <dl class="std envvar">
  1293. <dt class="sig sig-object std" id="envvar-PY_CORE_LDFLAGS">
  1294. <span class="sig-name descname"><span class="pre">PY_CORE_LDFLAGS</span></span><a class="headerlink" href="#envvar-PY_CORE_LDFLAGS" title="Link to this definition">¶</a></dt>
  1295. <dd><p>Linker flags used for building the interpreter object files.</p>
  1296. <div class="versionadded">
  1297. <p><span class="versionmodified added">New in version 3.8.</span></p>
  1298. </div>
  1299. </dd></dl>
  1300. </section>
  1301. </section>
  1302. </section>
  1303. <div class="clearer"></div>
  1304. </div>
  1305. </div>
  1306. </div>
  1307. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  1308. <div class="sphinxsidebarwrapper">
  1309. <div>
  1310. <h3><a href="../contents.html">Table of Contents</a></h3>
  1311. <ul>
  1312. <li><a class="reference internal" href="#">3. Configure Python</a><ul>
  1313. <li><a class="reference internal" href="#build-requirements">3.1. Build Requirements</a></li>
  1314. <li><a class="reference internal" href="#generated-files">3.2. Generated files</a><ul>
  1315. <li><a class="reference internal" href="#configure-script">3.2.1. configure script</a></li>
  1316. </ul>
  1317. </li>
  1318. <li><a class="reference internal" href="#configure-options">3.3. Configure Options</a><ul>
  1319. <li><a class="reference internal" href="#general-options">3.3.1. General Options</a></li>
  1320. <li><a class="reference internal" href="#webassembly-options">3.3.2. WebAssembly Options</a></li>
  1321. <li><a class="reference internal" href="#install-options">3.3.3. Install Options</a></li>
  1322. <li><a class="reference internal" href="#performance-options">3.3.4. Performance options</a></li>
  1323. <li><a class="reference internal" href="#python-debug-build">3.3.5. Python Debug Build</a></li>
  1324. <li><a class="reference internal" href="#debug-options">3.3.6. Debug options</a></li>
  1325. <li><a class="reference internal" href="#linker-options">3.3.7. Linker options</a></li>
  1326. <li><a class="reference internal" href="#libraries-options">3.3.8. Libraries options</a></li>
  1327. <li><a class="reference internal" href="#security-options">3.3.9. Security Options</a></li>
  1328. <li><a class="reference internal" href="#macos-options">3.3.10. macOS Options</a></li>
  1329. <li><a class="reference internal" href="#cross-compiling-options">3.3.11. Cross Compiling Options</a></li>
  1330. </ul>
  1331. </li>
  1332. <li><a class="reference internal" href="#python-build-system">3.4. Python Build System</a><ul>
  1333. <li><a class="reference internal" href="#main-files-of-the-build-system">3.4.1. Main files of the build system</a></li>
  1334. <li><a class="reference internal" href="#main-build-steps">3.4.2. Main build steps</a></li>
  1335. <li><a class="reference internal" href="#main-makefile-targets">3.4.3. Main Makefile targets</a></li>
  1336. <li><a class="reference internal" href="#c-extensions">3.4.4. C extensions</a></li>
  1337. </ul>
  1338. </li>
  1339. <li><a class="reference internal" href="#compiler-and-linker-flags">3.5. Compiler and linker flags</a><ul>
  1340. <li><a class="reference internal" href="#preprocessor-flags">3.5.1. Preprocessor flags</a></li>
  1341. <li><a class="reference internal" href="#compiler-flags">3.5.2. Compiler flags</a></li>
  1342. <li><a class="reference internal" href="#linker-flags">3.5.3. Linker flags</a></li>
  1343. </ul>
  1344. </li>
  1345. </ul>
  1346. </li>
  1347. </ul>
  1348. </div>
  1349. <div>
  1350. <h4>Previous topic</h4>
  1351. <p class="topless"><a href="unix.html"
  1352. title="previous chapter"><span class="section-number">2. </span>Using Python on Unix platforms</a></p>
  1353. </div>
  1354. <div>
  1355. <h4>Next topic</h4>
  1356. <p class="topless"><a href="windows.html"
  1357. title="next chapter"><span class="section-number">4. </span>Using Python on Windows</a></p>
  1358. </div>
  1359. <div role="note" aria-label="source link">
  1360. <h3>This Page</h3>
  1361. <ul class="this-page-menu">
  1362. <li><a href="../bugs.html">Report a Bug</a></li>
  1363. <li>
  1364. <a href="https://github.com/python/cpython/blob/main/Doc/using/configure.rst"
  1365. rel="nofollow">Show Source
  1366. </a>
  1367. </li>
  1368. </ul>
  1369. </div>
  1370. </div>
  1371. <div id="sidebarbutton" title="Collapse sidebar">
  1372. <span>«</span>
  1373. </div>
  1374. </div>
  1375. <div class="clearer"></div>
  1376. </div>
  1377. <div class="related" role="navigation" aria-label="related navigation">
  1378. <h3>Navigation</h3>
  1379. <ul>
  1380. <li class="right" style="margin-right: 10px">
  1381. <a href="../genindex.html" title="General Index"
  1382. >index</a></li>
  1383. <li class="right" >
  1384. <a href="../py-modindex.html" title="Python Module Index"
  1385. >modules</a> |</li>
  1386. <li class="right" >
  1387. <a href="windows.html" title="4. Using Python on Windows"
  1388. >next</a> |</li>
  1389. <li class="right" >
  1390. <a href="unix.html" title="2. Using Python on Unix platforms"
  1391. >previous</a> |</li>
  1392. <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
  1393. <li><a href="https://www.python.org/">Python</a> &#187;</li>
  1394. <li class="switchers">
  1395. <div class="language_switcher_placeholder"></div>
  1396. <div class="version_switcher_placeholder"></div>
  1397. </li>
  1398. <li>
  1399. </li>
  1400. <li id="cpython-language-and-version">
  1401. <a href="../index.html">3.12.3 Documentation</a> &#187;
  1402. </li>
  1403. <li class="nav-item nav-item-1"><a href="index.html" >Python Setup and Usage</a> &#187;</li>
  1404. <li class="nav-item nav-item-this"><a href=""><span class="section-number">3. </span>Configure Python</a></li>
  1405. <li class="right">
  1406. <div class="inline-search" role="search">
  1407. <form class="inline-search" action="../search.html" method="get">
  1408. <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
  1409. <input type="submit" value="Go" />
  1410. </form>
  1411. </div>
  1412. |
  1413. </li>
  1414. <li class="right">
  1415. <label class="theme-selector-label">
  1416. Theme
  1417. <select class="theme-selector" oninput="activateTheme(this.value)">
  1418. <option value="auto" selected>Auto</option>
  1419. <option value="light">Light</option>
  1420. <option value="dark">Dark</option>
  1421. </select>
  1422. </label> |</li>
  1423. </ul>
  1424. </div>
  1425. <div class="footer">
  1426. &copy;
  1427. <a href="../copyright.html">
  1428. Copyright
  1429. </a>
  1430. 2001-2024, Python Software Foundation.
  1431. <br />
  1432. This page is licensed under the Python Software Foundation License Version 2.
  1433. <br />
  1434. Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
  1435. <br />
  1436. See <a href="/license.html">History and License</a> for more information.<br />
  1437. <br />
  1438. The Python Software Foundation is a non-profit corporation.
  1439. <a href="https://www.python.org/psf/donations/">Please donate.</a>
  1440. <br />
  1441. <br />
  1442. Last updated on Apr 09, 2024 (13:47 UTC).
  1443. <a href="/bugs.html">Found a bug</a>?
  1444. <br />
  1445. Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.2.6.
  1446. </div>
  1447. </body>
  1448. </html>
上海开阖软件有限公司 沪ICP备12045867号-1