548 lines
29 KiB
HTML
548 lines
29 KiB
HTML
<!DOCTYPE html>
|
||
|
||
<html lang="en" data-content_root="../">
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
||
<meta property="og:title" content="2. Using Python on Unix platforms" />
|
||
<meta property="og:type" content="website" />
|
||
<meta property="og:url" content="https://docs.python.org/3/using/unix.html" />
|
||
<meta property="og:site_name" content="Python documentation" />
|
||
<meta property="og:description" content="Getting and installing the latest version of Python: On Linux: Python comes preinstalled on most Linux distributions, and is available as a package on all others. However there are certain features..." />
|
||
<meta property="og:image" content="https://docs.python.org/3/_static/og-image.png" />
|
||
<meta property="og:image:alt" content="Python documentation" />
|
||
<meta name="description" content="Getting and installing the latest version of Python: On Linux: Python comes preinstalled on most Linux distributions, and is available as a package on all others. However there are certain features..." />
|
||
<meta property="og:image:width" content="200">
|
||
<meta property="og:image:height" content="200">
|
||
<meta name="theme-color" content="#3776ab">
|
||
|
||
<title>2. Using Python on Unix platforms — Python 3.13.3 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
||
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=b86133f3" />
|
||
<link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?v=23252803" />
|
||
<link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css?v=5349f25f" />
|
||
|
||
<script src="../_static/documentation_options.js?v=5d57ca2d"></script>
|
||
<script src="../_static/doctools.js?v=9bcbadda"></script>
|
||
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
||
|
||
<script src="../_static/sidebar.js"></script>
|
||
|
||
<link rel="search" type="application/opensearchdescription+xml"
|
||
title="Search within Python 3.13.3 documentation"
|
||
href="../_static/opensearch.xml"/>
|
||
<link rel="author" title="About these documents" href="../about.html" />
|
||
<link rel="index" title="Index" href="../genindex.html" />
|
||
<link rel="search" title="Search" href="../search.html" />
|
||
<link rel="copyright" title="Copyright" href="../copyright.html" />
|
||
<link rel="next" title="3. Configure Python" href="configure.html" />
|
||
<link rel="prev" title="1. Command line and environment" href="cmdline.html" />
|
||
|
||
<link rel="canonical" href="https://docs.python.org/3/using/unix.html">
|
||
|
||
|
||
|
||
|
||
|
||
<style>
|
||
@media only screen {
|
||
table.full-width-table {
|
||
width: 100%;
|
||
}
|
||
}
|
||
</style>
|
||
<link rel="stylesheet" href="../_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">
|
||
<link rel="shortcut icon" type="image/png" href="../_static/py.svg" />
|
||
<script type="text/javascript" src="../_static/copybutton.js"></script>
|
||
<script type="text/javascript" src="../_static/menu.js"></script>
|
||
<script type="text/javascript" src="../_static/search-focus.js"></script>
|
||
<script type="text/javascript" src="../_static/themetoggle.js"></script>
|
||
<script type="text/javascript" src="../_static/rtd_switcher.js"></script>
|
||
<meta name="readthedocs-addons-api-version" content="1">
|
||
|
||
</head>
|
||
<body>
|
||
<div class="mobile-nav">
|
||
<input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"
|
||
aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu" />
|
||
<nav class="nav-content" role="navigation">
|
||
<label for="menuToggler" class="toggler__label">
|
||
<span></span>
|
||
</label>
|
||
<span class="nav-items-wrapper">
|
||
<a href="https://www.python.org/" class="nav-logo">
|
||
<img src="../_static/py.svg" alt="Python logo"/>
|
||
</a>
|
||
<span class="version_switcher_placeholder"></span>
|
||
<form role="search" class="search" action="../search.html" method="get">
|
||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">
|
||
<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>
|
||
</svg>
|
||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" />
|
||
<input type="submit" value="Go"/>
|
||
</form>
|
||
</span>
|
||
</nav>
|
||
<div class="menu-wrapper">
|
||
<nav class="menu" role="navigation" aria-label="main navigation">
|
||
<div class="language_switcher_placeholder"></div>
|
||
|
||
<label class="theme-selector-label">
|
||
Theme
|
||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
||
<option value="auto" selected>Auto</option>
|
||
<option value="light">Light</option>
|
||
<option value="dark">Dark</option>
|
||
</select>
|
||
</label>
|
||
<div>
|
||
<h3><a href="../contents.html">Table of Contents</a></h3>
|
||
<ul>
|
||
<li><a class="reference internal" href="#">2. Using Python on Unix platforms</a><ul>
|
||
<li><a class="reference internal" href="#getting-and-installing-the-latest-version-of-python">2.1. Getting and installing the latest version of Python</a><ul>
|
||
<li><a class="reference internal" href="#on-linux">2.1.1. On Linux</a><ul>
|
||
<li><a class="reference internal" href="#installing-idle">2.1.1.1. Installing IDLE</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#on-freebsd-and-openbsd">2.1.2. On FreeBSD and OpenBSD</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#building-python">2.2. Building Python</a></li>
|
||
<li><a class="reference internal" href="#python-related-paths-and-files">2.3. Python-related paths and files</a></li>
|
||
<li><a class="reference internal" href="#miscellaneous">2.4. Miscellaneous</a></li>
|
||
<li><a class="reference internal" href="#custom-openssl">2.5. Custom OpenSSL</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
|
||
</div>
|
||
<div>
|
||
<h4>Previous topic</h4>
|
||
<p class="topless"><a href="cmdline.html"
|
||
title="previous chapter"><span class="section-number">1. </span>Command line and environment</a></p>
|
||
</div>
|
||
<div>
|
||
<h4>Next topic</h4>
|
||
<p class="topless"><a href="configure.html"
|
||
title="next chapter"><span class="section-number">3. </span>Configure Python</a></p>
|
||
</div>
|
||
<div role="note" aria-label="source link">
|
||
<h3>This Page</h3>
|
||
<ul class="this-page-menu">
|
||
<li><a href="../bugs.html">Report a Bug</a></li>
|
||
<li>
|
||
<a href="https://github.com/python/cpython/blob/main/Doc/using/unix.rst"
|
||
rel="nofollow">Show Source
|
||
</a>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</nav>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div class="related" role="navigation" aria-label="Related">
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="../genindex.html" title="General Index"
|
||
accesskey="I">index</a></li>
|
||
<li class="right" >
|
||
<a href="../py-modindex.html" title="Python Module Index"
|
||
>modules</a> |</li>
|
||
<li class="right" >
|
||
<a href="configure.html" title="3. Configure Python"
|
||
accesskey="N">next</a> |</li>
|
||
<li class="right" >
|
||
<a href="cmdline.html" title="1. Command line and environment"
|
||
accesskey="P">previous</a> |</li>
|
||
|
||
<li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
|
||
<li><a href="https://www.python.org/">Python</a> »</li>
|
||
<li class="switchers">
|
||
<div class="language_switcher_placeholder"></div>
|
||
<div class="version_switcher_placeholder"></div>
|
||
</li>
|
||
<li>
|
||
|
||
</li>
|
||
<li id="cpython-language-and-version">
|
||
<a href="../index.html">3.13.3 Documentation</a> »
|
||
</li>
|
||
|
||
<li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Python Setup and Usage</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">2. </span>Using Python on Unix platforms</a></li>
|
||
<li class="right">
|
||
|
||
|
||
<div class="inline-search" role="search">
|
||
<form class="inline-search" action="../search.html" method="get">
|
||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
|
||
<input type="submit" value="Go" />
|
||
</form>
|
||
</div>
|
||
|
|
||
</li>
|
||
<li class="right">
|
||
<label class="theme-selector-label">
|
||
Theme
|
||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
||
<option value="auto" selected>Auto</option>
|
||
<option value="light">Light</option>
|
||
<option value="dark">Dark</option>
|
||
</select>
|
||
</label> |</li>
|
||
|
||
</ul>
|
||
</div>
|
||
|
||
<div class="document">
|
||
<div class="documentwrapper">
|
||
<div class="bodywrapper">
|
||
<div class="body" role="main">
|
||
|
||
<section id="using-python-on-unix-platforms">
|
||
<span id="using-on-unix"></span><h1><span class="section-number">2. </span>Using Python on Unix platforms<a class="headerlink" href="#using-python-on-unix-platforms" title="Link to this heading">¶</a></h1>
|
||
<section id="getting-and-installing-the-latest-version-of-python">
|
||
<h2><span class="section-number">2.1. </span>Getting and installing the latest version of Python<a class="headerlink" href="#getting-and-installing-the-latest-version-of-python" title="Link to this heading">¶</a></h2>
|
||
<section id="on-linux">
|
||
<h3><span class="section-number">2.1.1. </span>On Linux<a class="headerlink" href="#on-linux" title="Link to this heading">¶</a></h3>
|
||
<p>Python comes preinstalled on most Linux distributions, and is available as a
|
||
package on all others. However there are certain features you might want to use
|
||
that are not available on your distro’s package. You can compile the
|
||
latest version of Python from source.</p>
|
||
<p>In the event that the latest version of Python doesn’t come preinstalled and isn’t
|
||
in the repositories as well, you can make packages for your own distro. Have a
|
||
look at the following links:</p>
|
||
<div class="admonition seealso">
|
||
<p class="admonition-title">See also</p>
|
||
<dl class="simple">
|
||
<dt><a class="reference external" href="https://www.debian.org/doc/manuals/maint-guide/first.en.html">https://www.debian.org/doc/manuals/maint-guide/first.en.html</a></dt><dd><p>for Debian users</p>
|
||
</dd>
|
||
<dt><a class="reference external" href="https://en.opensuse.org/Portal:Packaging">https://en.opensuse.org/Portal:Packaging</a></dt><dd><p>for OpenSuse users</p>
|
||
</dd>
|
||
<dt><a class="reference external" href="https://docs.fedoraproject.org/en-US/package-maintainers/Packaging_Tutorial_GNU_Hello/">https://docs.fedoraproject.org/en-US/package-maintainers/Packaging_Tutorial_GNU_Hello/</a></dt><dd><p>for Fedora users</p>
|
||
</dd>
|
||
<dt><a class="reference external" href="https://slackbook.org/html/package-management-making-packages.html">https://slackbook.org/html/package-management-making-packages.html</a></dt><dd><p>for Slackware users</p>
|
||
</dd>
|
||
</dl>
|
||
</div>
|
||
<section id="installing-idle">
|
||
<span id="installing-idle-on-linux"></span><h4><span class="section-number">2.1.1.1. </span>Installing IDLE<a class="headerlink" href="#installing-idle" title="Link to this heading">¶</a></h4>
|
||
<p>In some cases, IDLE might not be included in your Python installation.</p>
|
||
<ul>
|
||
<li><p>For Debian and Ubuntu users:</p>
|
||
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>apt<span class="w"> </span>update
|
||
sudo<span class="w"> </span>apt<span class="w"> </span>install<span class="w"> </span>idle
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>For Fedora, RHEL, and CentOS users:</p>
|
||
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>dnf<span class="w"> </span>install<span class="w"> </span>python3-idle
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>For SUSE and OpenSUSE users:</p>
|
||
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>zypper<span class="w"> </span>install<span class="w"> </span>python3-idle
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>For Alpine Linux users:</p>
|
||
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>apk<span class="w"> </span>add<span class="w"> </span>python3-idle
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</section>
|
||
</section>
|
||
<section id="on-freebsd-and-openbsd">
|
||
<h3><span class="section-number">2.1.2. </span>On FreeBSD and OpenBSD<a class="headerlink" href="#on-freebsd-and-openbsd" title="Link to this heading">¶</a></h3>
|
||
<ul>
|
||
<li><p>FreeBSD users, to add the package use:</p>
|
||
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>pkg<span class="w"> </span>install<span class="w"> </span>python3
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>OpenBSD users, to add the package use:</p>
|
||
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>pkg_add<span class="w"> </span>-r<span class="w"> </span>python
|
||
|
||
pkg_add<span class="w"> </span>ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages/<insert<span class="w"> </span>your<span class="w"> </span>architecture<span class="w"> </span>here>/python-<version>.tgz
|
||
</pre></div>
|
||
</div>
|
||
<p>For example i386 users get the 2.5.1 version of Python using:</p>
|
||
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>pkg_add<span class="w"> </span>ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages/i386/python-2.5.1p2.tgz
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</section>
|
||
</section>
|
||
<section id="building-python">
|
||
<span id="building-python-on-unix"></span><h2><span class="section-number">2.2. </span>Building Python<a class="headerlink" href="#building-python" title="Link to this heading">¶</a></h2>
|
||
<p>If you want to compile CPython yourself, first thing you should do is get the
|
||
<a class="reference external" href="https://www.python.org/downloads/source/">source</a>. You can download either the
|
||
latest release’s source or just grab a fresh <a class="reference external" href="https://devguide.python.org/setup/#get-the-source-code">clone</a>. (If you want
|
||
to contribute patches, you will need a clone.)</p>
|
||
<p>The build process consists of the usual commands:</p>
|
||
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>./configure
|
||
make
|
||
make<span class="w"> </span>install
|
||
</pre></div>
|
||
</div>
|
||
<p><a class="reference internal" href="configure.html#configure-options"><span class="std std-ref">Configuration options</span></a> and caveats for specific Unix
|
||
platforms are extensively documented in the <a class="extlink-source reference external" href="https://github.com/python/cpython/tree/3.13/README.rst">README.rst</a> file in the
|
||
root of the Python source tree.</p>
|
||
<div class="admonition warning">
|
||
<p class="admonition-title">Warning</p>
|
||
<p><code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">install</span></code> can overwrite or masquerade the <code class="file docutils literal notranslate"><span class="pre">python3</span></code> binary.
|
||
<code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">altinstall</span></code> is therefore recommended instead of <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">install</span></code>
|
||
since it only installs <code class="file docutils literal notranslate"><em><span class="pre">exec_prefix</span></em><span class="pre">/bin/python</span><em><span class="pre">version</span></em></code>.</p>
|
||
</div>
|
||
</section>
|
||
<section id="python-related-paths-and-files">
|
||
<h2><span class="section-number">2.3. </span>Python-related paths and files<a class="headerlink" href="#python-related-paths-and-files" title="Link to this heading">¶</a></h2>
|
||
<p>These are subject to difference depending on local installation conventions;
|
||
<a class="reference internal" href="configure.html#cmdoption-prefix"><code class="xref std std-option docutils literal notranslate"><span class="pre">prefix</span></code></a> and <a class="reference internal" href="configure.html#cmdoption-exec-prefix"><code class="xref std std-option docutils literal notranslate"><span class="pre">exec_prefix</span></code></a>
|
||
are installation-dependent and should be interpreted as for GNU software; they
|
||
may be the same.</p>
|
||
<p>For example, on most Linux systems, the default for both is <code class="file docutils literal notranslate"><span class="pre">/usr</span></code>.</p>
|
||
<table class="docutils align-default">
|
||
<thead>
|
||
<tr class="row-odd"><th class="head"><p>File/directory</p></th>
|
||
<th class="head"><p>Meaning</p></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr class="row-even"><td><p><code class="file docutils literal notranslate"><em><span class="pre">exec_prefix</span></em><span class="pre">/bin/python3</span></code></p></td>
|
||
<td><p>Recommended location of the interpreter.</p></td>
|
||
</tr>
|
||
<tr class="row-odd"><td><p><code class="file docutils literal notranslate"><em><span class="pre">prefix</span></em><span class="pre">/lib/python</span><em><span class="pre">version</span></em></code>,
|
||
<code class="file docutils literal notranslate"><em><span class="pre">exec_prefix</span></em><span class="pre">/lib/python</span><em><span class="pre">version</span></em></code></p></td>
|
||
<td><p>Recommended locations of the directories
|
||
containing the standard modules.</p></td>
|
||
</tr>
|
||
<tr class="row-even"><td><p><code class="file docutils literal notranslate"><em><span class="pre">prefix</span></em><span class="pre">/include/python</span><em><span class="pre">version</span></em></code>,
|
||
<code class="file docutils literal notranslate"><em><span class="pre">exec_prefix</span></em><span class="pre">/include/python</span><em><span class="pre">version</span></em></code></p></td>
|
||
<td><p>Recommended locations of the directories
|
||
containing the include files needed for
|
||
developing Python extensions and
|
||
embedding the interpreter.</p></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</section>
|
||
<section id="miscellaneous">
|
||
<h2><span class="section-number">2.4. </span>Miscellaneous<a class="headerlink" href="#miscellaneous" title="Link to this heading">¶</a></h2>
|
||
<p>To easily use Python scripts on Unix, you need to make them executable,
|
||
e.g. with</p>
|
||
<div class="highlight-shell-session notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>chmod<span class="w"> </span>+x<span class="w"> </span>script
|
||
</pre></div>
|
||
</div>
|
||
<p>and put an appropriate Shebang line at the top of the script. A good choice is
|
||
usually</p>
|
||
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="ch">#!/usr/bin/env python3</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>which searches for the Python interpreter in the whole <span class="target" id="index-0"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">PATH</span></code>. However,
|
||
some Unices may not have the <strong class="program">env</strong> command, so you may need to hardcode
|
||
<code class="docutils literal notranslate"><span class="pre">/usr/bin/python3</span></code> as the interpreter path.</p>
|
||
<p>To use shell commands in your Python scripts, look at the <a class="reference internal" href="../library/subprocess.html#module-subprocess" title="subprocess: Subprocess management."><code class="xref py py-mod docutils literal notranslate"><span class="pre">subprocess</span></code></a> module.</p>
|
||
</section>
|
||
<section id="custom-openssl">
|
||
<span id="unix-custom-openssl"></span><h2><span class="section-number">2.5. </span>Custom OpenSSL<a class="headerlink" href="#custom-openssl" title="Link to this heading">¶</a></h2>
|
||
<ol class="arabic">
|
||
<li><p>To use your vendor’s OpenSSL configuration and system trust store, locate
|
||
the directory with <code class="docutils literal notranslate"><span class="pre">openssl.cnf</span></code> file or symlink in <code class="docutils literal notranslate"><span class="pre">/etc</span></code>. On most
|
||
distribution the file is either in <code class="docutils literal notranslate"><span class="pre">/etc/ssl</span></code> or <code class="docutils literal notranslate"><span class="pre">/etc/pki/tls</span></code>. The
|
||
directory should also contain a <code class="docutils literal notranslate"><span class="pre">cert.pem</span></code> file and/or a <code class="docutils literal notranslate"><span class="pre">certs</span></code>
|
||
directory.</p>
|
||
<div class="highlight-shell-session notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>find<span class="w"> </span>/etc/<span class="w"> </span>-name<span class="w"> </span>openssl.cnf<span class="w"> </span>-printf<span class="w"> </span><span class="s2">"%h\n"</span>
|
||
<span class="go">/etc/ssl</span>
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>Download, build, and install OpenSSL. Make sure you use <code class="docutils literal notranslate"><span class="pre">install_sw</span></code> and
|
||
not <code class="docutils literal notranslate"><span class="pre">install</span></code>. The <code class="docutils literal notranslate"><span class="pre">install_sw</span></code> target does not override
|
||
<code class="docutils literal notranslate"><span class="pre">openssl.cnf</span></code>.</p>
|
||
<div class="highlight-shell-session notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>curl<span class="w"> </span>-O<span class="w"> </span>https://www.openssl.org/source/openssl-VERSION.tar.gz
|
||
<span class="gp">$ </span>tar<span class="w"> </span>xzf<span class="w"> </span>openssl-VERSION
|
||
<span class="gp">$ </span><span class="nb">pushd</span><span class="w"> </span>openssl-VERSION
|
||
<span class="gp">$ </span>./config<span class="w"> </span><span class="se">\</span>
|
||
<span class="w"> </span>--prefix<span class="o">=</span>/usr/local/custom-openssl<span class="w"> </span><span class="se">\</span>
|
||
<span class="w"> </span>--libdir<span class="o">=</span>lib<span class="w"> </span><span class="se">\</span>
|
||
<span class="w"> </span>--openssldir<span class="o">=</span>/etc/ssl
|
||
<span class="gp">$ </span>make<span class="w"> </span>-j1<span class="w"> </span>depend
|
||
<span class="gp">$ </span>make<span class="w"> </span>-j8
|
||
<span class="gp">$ </span>make<span class="w"> </span>install_sw
|
||
<span class="gp">$ </span><span class="nb">popd</span>
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>Build Python with custom OpenSSL
|
||
(see the configure <code class="docutils literal notranslate"><span class="pre">--with-openssl</span></code> and <code class="docutils literal notranslate"><span class="pre">--with-openssl-rpath</span></code> options)</p>
|
||
<div class="highlight-shell-session notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span><span class="nb">pushd</span><span class="w"> </span>python-3.x.x
|
||
<span class="gp">$ </span>./configure<span class="w"> </span>-C<span class="w"> </span><span class="se">\</span>
|
||
<span class="w"> </span>--with-openssl<span class="o">=</span>/usr/local/custom-openssl<span class="w"> </span><span class="se">\</span>
|
||
<span class="w"> </span>--with-openssl-rpath<span class="o">=</span>auto<span class="w"> </span><span class="se">\</span>
|
||
<span class="w"> </span>--prefix<span class="o">=</span>/usr/local/python-3.x.x
|
||
<span class="gp">$ </span>make<span class="w"> </span>-j8
|
||
<span class="gp">$ </span>make<span class="w"> </span>altinstall
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
</ol>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>Patch releases of OpenSSL have a backwards compatible ABI. You don’t need
|
||
to recompile Python to update OpenSSL. It’s sufficient to replace the
|
||
custom OpenSSL installation with a newer version.</p>
|
||
</div>
|
||
</section>
|
||
</section>
|
||
|
||
|
||
<div class="clearer"></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="sphinxsidebar" role="navigation" aria-label="Main">
|
||
<div class="sphinxsidebarwrapper">
|
||
<div>
|
||
<h3><a href="../contents.html">Table of Contents</a></h3>
|
||
<ul>
|
||
<li><a class="reference internal" href="#">2. Using Python on Unix platforms</a><ul>
|
||
<li><a class="reference internal" href="#getting-and-installing-the-latest-version-of-python">2.1. Getting and installing the latest version of Python</a><ul>
|
||
<li><a class="reference internal" href="#on-linux">2.1.1. On Linux</a><ul>
|
||
<li><a class="reference internal" href="#installing-idle">2.1.1.1. Installing IDLE</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#on-freebsd-and-openbsd">2.1.2. On FreeBSD and OpenBSD</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#building-python">2.2. Building Python</a></li>
|
||
<li><a class="reference internal" href="#python-related-paths-and-files">2.3. Python-related paths and files</a></li>
|
||
<li><a class="reference internal" href="#miscellaneous">2.4. Miscellaneous</a></li>
|
||
<li><a class="reference internal" href="#custom-openssl">2.5. Custom OpenSSL</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
|
||
</div>
|
||
<div>
|
||
<h4>Previous topic</h4>
|
||
<p class="topless"><a href="cmdline.html"
|
||
title="previous chapter"><span class="section-number">1. </span>Command line and environment</a></p>
|
||
</div>
|
||
<div>
|
||
<h4>Next topic</h4>
|
||
<p class="topless"><a href="configure.html"
|
||
title="next chapter"><span class="section-number">3. </span>Configure Python</a></p>
|
||
</div>
|
||
<div role="note" aria-label="source link">
|
||
<h3>This Page</h3>
|
||
<ul class="this-page-menu">
|
||
<li><a href="../bugs.html">Report a Bug</a></li>
|
||
<li>
|
||
<a href="https://github.com/python/cpython/blob/main/Doc/using/unix.rst"
|
||
rel="nofollow">Show Source
|
||
</a>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div id="sidebarbutton" title="Collapse sidebar">
|
||
<span>«</span>
|
||
</div>
|
||
|
||
</div>
|
||
<div class="clearer"></div>
|
||
</div>
|
||
<div class="related" role="navigation" aria-label="Related">
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="../genindex.html" title="General Index"
|
||
>index</a></li>
|
||
<li class="right" >
|
||
<a href="../py-modindex.html" title="Python Module Index"
|
||
>modules</a> |</li>
|
||
<li class="right" >
|
||
<a href="configure.html" title="3. Configure Python"
|
||
>next</a> |</li>
|
||
<li class="right" >
|
||
<a href="cmdline.html" title="1. Command line and environment"
|
||
>previous</a> |</li>
|
||
|
||
<li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
|
||
<li><a href="https://www.python.org/">Python</a> »</li>
|
||
<li class="switchers">
|
||
<div class="language_switcher_placeholder"></div>
|
||
<div class="version_switcher_placeholder"></div>
|
||
</li>
|
||
<li>
|
||
|
||
</li>
|
||
<li id="cpython-language-and-version">
|
||
<a href="../index.html">3.13.3 Documentation</a> »
|
||
</li>
|
||
|
||
<li class="nav-item nav-item-1"><a href="index.html" >Python Setup and Usage</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">2. </span>Using Python on Unix platforms</a></li>
|
||
<li class="right">
|
||
|
||
|
||
<div class="inline-search" role="search">
|
||
<form class="inline-search" action="../search.html" method="get">
|
||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
|
||
<input type="submit" value="Go" />
|
||
</form>
|
||
</div>
|
||
|
|
||
</li>
|
||
<li class="right">
|
||
<label class="theme-selector-label">
|
||
Theme
|
||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
||
<option value="auto" selected>Auto</option>
|
||
<option value="light">Light</option>
|
||
<option value="dark">Dark</option>
|
||
</select>
|
||
</label> |</li>
|
||
|
||
</ul>
|
||
</div>
|
||
<div class="footer">
|
||
©
|
||
<a href="../copyright.html">
|
||
|
||
Copyright
|
||
|
||
</a>
|
||
2001-2025, Python Software Foundation.
|
||
<br />
|
||
This page is licensed under the Python Software Foundation License Version 2.
|
||
<br />
|
||
Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
|
||
<br />
|
||
|
||
See <a href="/license.html">History and License</a> for more information.<br />
|
||
|
||
|
||
<br />
|
||
|
||
The Python Software Foundation is a non-profit corporation.
|
||
<a href="https://www.python.org/psf/donations/">Please donate.</a>
|
||
<br />
|
||
<br />
|
||
Last updated on Apr 08, 2025 (14:33 UTC).
|
||
|
||
<a href="/bugs.html">Found a bug</a>?
|
||
|
||
<br />
|
||
|
||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.2.3.
|
||
</div>
|
||
|
||
</body>
|
||
</html> |