mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-09 07:24:04 +08:00
1 line
3.6 KiB
HTML
1 line
3.6 KiB
HTML
<div class="body" role="main"><div class="section" id="module-distutils"><h1><span class="yiyi-st" id="yiyi-10">28.1. <a class="reference internal" href="#module-distutils" title="distutils: Support for building and installing Python modules into an existing Python installation."><code class="xref py py-mod docutils literal"><span class="pre">distutils</span></code></a> - 构建和安装Python模块</span></h1><p><span class="yiyi-st" id="yiyi-11"><a class="reference internal" href="#module-distutils" title="distutils: Support for building and installing Python modules into an existing Python installation."><code class="xref py py-mod docutils literal"><span class="pre">distutils</span></code></a>包为在Python安装中构建和安装其他模块提供支持。</span><span class="yiyi-st" id="yiyi-12">新模块可以是100%的Python,或者可以是用C编写的扩展模块,或者可以是Python包的容器,其包括在Python和C中编码的模块。</span></p><p><span class="yiyi-st" id="yiyi-13">大多数Python用户将<em>不是</em>直接使用此模块,而是使用由Python包装管理局维护的交叉版本工具。</span><span class="yiyi-st" id="yiyi-14">特别地,<a class="reference external" href="https://setuptools.readthedocs.io/en/latest/">setuptools</a>是<a class="reference internal" href="#module-distutils" title="distutils: Support for building and installing Python modules into an existing Python installation."><code class="xref py py-mod docutils literal"><span class="pre">distutils</span></code></a>的增强型替代选项,它提供:</span></p><ul class="simple"><li><span class="yiyi-st" id="yiyi-15">支持声明项目依赖项</span></li><li><span class="yiyi-st" id="yiyi-16">用于配置要包括在源版本中的文件的其他机制(包括用于与版本控制系统集成的插件)</span></li><li><span class="yiyi-st" id="yiyi-17">能够声明项目“入口点”,这可以用作应用程序插件系统的基础</span></li><li><span class="yiyi-st" id="yiyi-18">在安装时自动生成Windows命令行可执行文件而不需要预构建它们的能力</span></li><li><span class="yiyi-st" id="yiyi-19">所有支持的Python版本的一致行为</span></li></ul><p><span class="yiyi-st" id="yiyi-20">推荐的<a class="reference external" href="https://pip.pypa.io/">pip</a>安装程序将使用<code class="docutils literal"><span class="pre">setuptools</span></code>运行所有<code class="docutils literal"><span class="pre">setup.py</span></code>脚本,即使脚本本身只导入<code class="docutils literal"><span class="pre">distutils</span></code>。</span><span class="yiyi-st" id="yiyi-21">有关详细信息,请参阅<a class="reference external" href="https://packaging.python.org">Python包装用户指南</a>。</span></p><p><span class="yiyi-st" id="yiyi-22">为了使包装工具作者和用户更深入地了解当前包装和分发系统的细节,传统的基于<a class="reference internal" href="#module-distutils" title="distutils: Support for building and installing Python modules into an existing Python installation."><code class="xref py py-mod docutils literal"><span class="pre">distutils</span></code></a>的用户文档和API参考仍然可用:</span></p><ul class="simple"><li><span class="yiyi-st" id="yiyi-23"><a class="reference internal" href="../install/index.html#install-index"><span>Installing Python Modules (Legacy version)</span></a></span></li><li><span class="yiyi-st" id="yiyi-24"><a class="reference internal" href="../distutils/index.html#distutils-index"><span>Distributing Python Modules (Legacy version)</span></a></span></li></ul></div></div> |