{"id":1108939,"date":"2025-01-08T17:05:10","date_gmt":"2025-01-08T09:05:10","guid":{"rendered":""},"modified":"2025-01-08T17:05:13","modified_gmt":"2025-01-08T09:05:13","slug":"%e5%a6%82%e4%bd%95%e5%b0%86python%e4%bb%a3%e7%a0%81%e5%bc%84%e6%88%90%e6%96%87%e4%bb%b6%e6%89%93%e5%8c%85","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1108939.html","title":{"rendered":"\u5982\u4f55\u5c06python\u4ee3\u7801\u5f04\u6210\u6587\u4ef6\u6253\u5305"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25072416\/d17aa963-cee8-4934-a751-ca1c91596ae4.webp\" alt=\"\u5982\u4f55\u5c06python\u4ee3\u7801\u5f04\u6210\u6587\u4ef6\u6253\u5305\" \/><\/p>\n<p><p> <strong>\u5c06Python\u4ee3\u7801\u6253\u5305\u6210\u6587\u4ef6\u7684\u6b65\u9aa4\u5305\u62ec\uff1a\u521b\u5efaPython\u5305\u3001\u4f7f\u7528setup.py\u8fdb\u884c\u6253\u5305\u3001\u751f\u6210\u53ef\u5206\u53d1\u6587\u4ef6\u3001\u5b89\u88c5\u548c\u6d4b\u8bd5\u5305\u3002<\/strong> \u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u8fd9\u4e9b\u6b65\u9aa4\uff0c\u5e2e\u52a9\u4f60\u8f7b\u677e\u5730\u5c06Python\u4ee3\u7801\u6253\u5305\u6210\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u521b\u5efaPython\u5305<\/h3>\n<\/p>\n<p><p>Python\u5305\u662f\u4e00\u4e2a\u5305\u542b\u4e00\u4e2a\u6216\u591a\u4e2a\u6a21\u5757\u7684\u76ee\u5f55\u3002\u4e3a\u4e86\u521b\u5efa\u4e00\u4e2aPython\u5305\uff0c\u6211\u4eec\u9700\u8981\u51c6\u5907\u4e00\u4e2a\u76ee\u5f55\uff0c\u5e76\u5728\u5176\u4e2d\u521b\u5efa\u4e00\u4e9b\u5fc5\u8981\u7684\u6587\u4ef6\u548c\u5b50\u76ee\u5f55\u3002<\/p>\n<\/p>\n<p><h4>1. \u9879\u76ee\u7ed3\u6784<\/h4>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u89c4\u5212\u597d\u4f60\u7684\u9879\u76ee\u7ed3\u6784\u3002\u5047\u8bbe\u6211\u4eec\u6709\u4e00\u4e2a\u7b80\u5355\u7684\u9879\u76ee\uff0c\u5305\u542b\u4ee5\u4e0b\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code>my_package\/<\/p>\n<p>    __init__.py<\/p>\n<p>    module1.py<\/p>\n<p>    module2.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ul>\n<li><code>__init__.py<\/code> \u6587\u4ef6\uff1a\u8fd9\u4e2a\u6587\u4ef6\u53ef\u4ee5\u662f\u7a7a\u7684\uff0c\u4f46\u5b83\u7684\u5b58\u5728\u8868\u793a\u8be5\u76ee\u5f55\u662f\u4e00\u4e2aPython\u5305\u3002<\/li>\n<li><code>module1.py<\/code> \u548c <code>module2.py<\/code>\uff1a\u8fd9\u4e9b\u662f\u5305\u4e2d\u7684\u6a21\u5757\u6587\u4ef6\u3002<\/li>\n<\/ul>\n<p><h4>2. \u7f16\u5199\u4ee3\u7801<\/h4>\n<\/p>\n<p><p>\u63a5\u4e0b\u6765\uff0c\u5728<code>module1.py<\/code>\u548c<code>module2.py<\/code>\u4e2d\u7f16\u5199\u4f60\u7684\u4ee3\u7801\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># module1.py<\/p>\n<p>def hello():<\/p>\n<p>    print(&quot;Hello from module1&quot;)<\/p>\n<h2><strong>module2.py<\/strong><\/h2>\n<p>def world():<\/p>\n<p>    print(&quot;World from module2&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e8c\u3001\u4f7f\u7528setup.py\u8fdb\u884c\u6253\u5305<\/h3>\n<\/p>\n<p><p><code>setup.py<\/code>\u662f\u6253\u5305\u548c\u5206\u53d1Python\u9879\u76ee\u7684\u6838\u5fc3\u6587\u4ef6\u3002\u8fd9\u4e2a\u6587\u4ef6\u5305\u542b\u4e86\u6709\u5173\u5305\u7684\u6240\u6709\u4fe1\u606f\uff0c\u5982\u540d\u79f0\u3001\u7248\u672c\u3001\u4f5c\u8005\u7b49\u3002<\/p>\n<\/p>\n<p><h4>1. \u521b\u5efasetup.py\u6587\u4ef6<\/h4>\n<\/p>\n<p><p>\u5728<code>my_package<\/code>\u76ee\u5f55\u4e2d\u521b\u5efa<code>setup.py<\/code>\u6587\u4ef6\uff0c\u5e76\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from setuptools import setup, find_packages<\/p>\n<p>setup(<\/p>\n<p>    name=&#39;my_package&#39;,<\/p>\n<p>    version=&#39;0.1&#39;,<\/p>\n<p>    packages=find_packages(),<\/p>\n<p>    install_requires=[<\/p>\n<p>        # \u5217\u51fa\u4f60\u7684\u9879\u76ee\u6240\u9700\u7684\u6240\u6709\u4f9d\u8d56\u5305<\/p>\n<p>    ],<\/p>\n<p>    author=&#39;Your Name&#39;,<\/p>\n<p>    author_em<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>l=&#39;your.email@example.com&#39;,<\/p>\n<p>    description=&#39;A simple example package&#39;,<\/p>\n<p>    url=&#39;https:\/\/github.com\/yourusername\/my_package&#39;,<\/p>\n<p>    classifiers=[<\/p>\n<p>        &#39;Programming Language :: Python :: 3&#39;,<\/p>\n<p>        &#39;License :: OSI Approved :: MIT License&#39;,<\/p>\n<p>        &#39;Operating System :: OS Independent&#39;,<\/p>\n<p>    ],<\/p>\n<p>)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ul>\n<li><code>name<\/code>\uff1a\u5305\u7684\u540d\u79f0\u3002<\/li>\n<li><code>version<\/code>\uff1a\u5305\u7684\u7248\u672c\u3002<\/li>\n<li><code>packages<\/code>\uff1a\u4f7f\u7528<code>find_packages()<\/code>\u81ea\u52a8\u67e5\u627e\u5305\u3002<\/li>\n<li><code>install_requires<\/code>\uff1a\u5217\u51fa\u6240\u6709\u4f9d\u8d56\u9879\u3002<\/li>\n<li><code>author<\/code>\u548c<code>author_email<\/code>\uff1a\u4f5c\u8005\u4fe1\u606f\u3002<\/li>\n<li><code>description<\/code>\u548c<code>url<\/code>\uff1a\u5305\u7684\u63cf\u8ff0\u548c\u9879\u76ee\u4e3b\u9875\u3002<\/li>\n<li><code>classifiers<\/code>\uff1a\u4e00\u4e9b\u5206\u7c7b\u6807\u7b7e\u3002<\/li>\n<\/ul>\n<p><h3>\u4e09\u3001\u751f\u6210\u53ef\u5206\u53d1\u6587\u4ef6<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528<code>setup.py<\/code>\u6587\u4ef6\uff0c\u751f\u6210\u53ef\u4ee5\u5206\u53d1\u548c\u5b89\u88c5\u7684\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h4>1. \u5b89\u88c5\u5fc5\u8981\u7684\u5de5\u5177<\/h4>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u786e\u4fdd\u4f60\u5df2\u7ecf\u5b89\u88c5\u4e86<code>setuptools<\/code>\u548c<code>wheel<\/code>\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install setuptools wheel<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u751f\u6210\u5206\u53d1\u6587\u4ef6<\/h4>\n<\/p>\n<p><p>\u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python setup.py sdist bdist_wheel<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u751f\u6210<code>dist<\/code>\u76ee\u5f55\uff0c\u5176\u4e2d\u5305\u542b\u4e24\u4e2a\u6587\u4ef6\uff1a\u4e00\u4e2a\u6e90\u4ee3\u7801\u5f52\u6863\u6587\u4ef6\uff08<code>.tar.gz<\/code>\uff09\u548c\u4e00\u4e2aWheel\u6587\u4ef6\uff08<code>.whl<\/code>\uff09\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u5b89\u88c5\u548c\u6d4b\u8bd5\u5305<\/h3>\n<\/p>\n<p><p>\u6700\u540e\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5\u5e76\u6d4b\u8bd5\u751f\u6210\u7684\u5305\uff0c\u4ee5\u786e\u4fdd\u5176\u5de5\u4f5c\u6b63\u5e38\u3002<\/p>\n<\/p>\n<p><h4>1. \u5b89\u88c5\u5305<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528<code>pip<\/code>\u5b89\u88c5\u751f\u6210\u7684Wheel\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install dist\/my_package-0.1-py3-none-any.whl<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u6d4b\u8bd5\u5305<\/h4>\n<\/p>\n<p><p>\u5728\u5b89\u88c5\u5305\u540e\uff0c\u4f60\u53ef\u4ee5\u5bfc\u5165\u5e76\u4f7f\u7528\u5305\u4e2d\u7684\u6a21\u5757\u6765\u6d4b\u8bd5\u5b83\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from my_package import module1, module2<\/p>\n<p>module1.hello()<\/p>\n<p>module2.world()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e94\u3001\u53d1\u5e03\u5230PyPI<\/h3>\n<\/p>\n<p><p>\u5982\u679c\u4f60\u5e0c\u671b\u5c06\u5305\u53d1\u5e03\u5230Python Package Index (PyPI)\uff0c\u4ee5\u4fbf\u5176\u4ed6\u4eba\u53ef\u4ee5\u5b89\u88c5\u548c\u4f7f\u7528\u5b83\uff0c\u53ef\u4ee5\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<p><h4>1. \u6ce8\u518cPyPI\u8d26\u6237<\/h4>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u5728PyPI\uff08<a href=\"https:\/\/pypi.org\/%EF%BC%89%E4%B8%8A%E6%B3%A8%E5%86%8C%E4%B8%80%E4%B8%AA%E8%B4%A6%E6%88%B7%E3%80%82\">https:\/\/pypi.org\/\uff09\u4e0a\u6ce8\u518c\u4e00\u4e2a\u8d26\u6237\u3002<\/a><\/p>\n<\/p>\n<p><h4>2. \u5b89\u88c5Twine<\/h4>\n<\/p>\n<p><p>Twine\u662f\u4e00\u4e2a\u7528\u4e8e\u5c06\u5305\u4e0a\u4f20\u5230PyPI\u7684\u5de5\u5177\u3002\u5b89\u88c5Twine\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install twine<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3. \u4e0a\u4f20\u5305<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528Twine\u5c06\u5305\u4e0a\u4f20\u5230PyPI\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">twine upload dist\/*<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4f60\u9700\u8981\u8f93\u5165\u4f60\u7684PyPI\u7528\u6237\u540d\u548c\u5bc6\u7801\u3002\u4e0a\u4f20\u6210\u529f\u540e\uff0c\u4f60\u7684\u5305\u5c06\u5728PyPI\u4e0a\u53ef\u7528\uff0c\u5176\u4ed6\u4eba\u53ef\u4ee5\u4f7f\u7528<code>pip install<\/code>\u6765\u5b89\u88c5\u5b83\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u7ef4\u62a4\u548c\u66f4\u65b0\u5305<\/h3>\n<\/p>\n<p><p>\u53d1\u5e03\u5305\u540e\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u8fdb\u884c\u7ef4\u62a4\u548c\u66f4\u65b0\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5efa\u8bae\uff1a<\/p>\n<\/p>\n<p><h4>1. \u7248\u672c\u63a7\u5236<\/h4>\n<\/p>\n<p><p>\u5728<code>setup.py<\/code>\u4e2d\u4f7f\u7528\u8bed\u4e49\u5316\u7248\u672c\u63a7\u5236\uff08Semantic Versioning\uff09\uff0c\u4ee5\u4fbf\u7528\u6237\u4e86\u89e3\u6bcf\u4e2a\u7248\u672c\u7684\u53d8\u5316\u3002\u4f8b\u5982\uff0c0.1.0\u8868\u793a\u521d\u59cb\u53d1\u5e03\uff0c0.1.1\u8868\u793a\u5c0f\u7684\u4fee\u590d\u6216\u6539\u8fdb\uff0c0.2.0\u8868\u793a\u6dfb\u52a0\u4e86\u65b0\u529f\u80fd\u3002<\/p>\n<\/p>\n<p><h4>2. \u6587\u6863\u548c\u793a\u4f8b<\/h4>\n<\/p>\n<p><p>\u63d0\u4f9b\u8be6\u7ec6\u7684\u6587\u6863\u548c\u793a\u4f8b\u4ee3\u7801\uff0c\u5e2e\u52a9\u7528\u6237\u7406\u89e3\u5982\u4f55\u4f7f\u7528\u4f60\u7684\u5305\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528<code>README.md<\/code>\u6587\u4ef6\u6216\u5728\u9879\u76ee\u4e3b\u9875\u4e0a\u63d0\u4f9b\u6587\u6863\u3002<\/p>\n<\/p>\n<p><h4>3. \u89e3\u51b3\u95ee\u9898\u548c\u54cd\u5e94\u53cd\u9988<\/h4>\n<\/p>\n<p><p>\u79ef\u6781\u89e3\u51b3\u7528\u6237\u62a5\u544a\u7684\u95ee\u9898\uff0c\u5e76\u53ca\u65f6\u54cd\u5e94\u53cd\u9988\u3002\u8fd9\u5c06\u6709\u52a9\u4e8e\u5efa\u7acb\u826f\u597d\u7684\u58f0\u8a89\uff0c\u5e76\u589e\u52a0\u7528\u6237\u7684\u4fe1\u4efb\u3002<\/p>\n<\/p>\n<p><h4>4. \u6301\u7eed\u96c6\u6210<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528\u6301\u7eed\u96c6\u6210\uff08CI\uff09\u5de5\u5177\uff0c\u5982GitHub Actions\u3001Travis CI\u6216CircleCI\uff0c\u81ea\u52a8\u6d4b\u8bd5\u4f60\u7684\u5305\u3002\u8fd9\u6709\u52a9\u4e8e\u786e\u4fdd\u6bcf\u6b21\u63d0\u4ea4\u548c\u53d1\u5e03\u7684\u4ee3\u7801\u90fd\u662f\u9ad8\u8d28\u91cf\u7684\u3002<\/p>\n<\/p>\n<p><h3>\u4e03\u3001\u793a\u4f8b\u9879\u76ee<\/h3>\n<\/p>\n<p><p>\u4e3a\u4e86\u66f4\u597d\u5730\u7406\u89e3\u4e0a\u8ff0\u6b65\u9aa4\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4e00\u4e2a\u793a\u4f8b\u9879\u76ee\u6765\u6f14\u793a\u6574\u4e2a\u8fc7\u7a0b\u3002<\/p>\n<\/p>\n<p><h4>1. \u9879\u76ee\u7ed3\u6784<\/h4>\n<\/p>\n<p><p>\u5047\u8bbe\u6211\u4eec\u8981\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684\u6570\u5b66\u8fd0\u7b97\u5305\uff0c\u9879\u76ee\u7ed3\u6784\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code>math_operations\/<\/p>\n<p>    __init__.py<\/p>\n<p>    addition.py<\/p>\n<p>    subtraction.py<\/p>\n<p>    setup.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u7f16\u5199\u4ee3\u7801<\/h4>\n<\/p>\n<p><p>\u5728<code>addition.py<\/code>\u548c<code>subtraction.py<\/code>\u4e2d\u7f16\u5199\u4ee3\u7801\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># addition.py<\/p>\n<p>def add(a, b):<\/p>\n<p>    return a + b<\/p>\n<h2><strong>subtraction.py<\/strong><\/h2>\n<p>def subtract(a, b):<\/p>\n<p>    return a - b<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3. \u521b\u5efasetup.py\u6587\u4ef6<\/h4>\n<\/p>\n<p><p>\u5728<code>math_operations<\/code>\u76ee\u5f55\u4e2d\u521b\u5efa<code>setup.py<\/code>\u6587\u4ef6\uff0c\u5e76\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from setuptools import setup, find_packages<\/p>\n<p>setup(<\/p>\n<p>    name=&#39;math_operations&#39;,<\/p>\n<p>    version=&#39;0.1&#39;,<\/p>\n<p>    packages=find_packages(),<\/p>\n<p>    install_requires=[],<\/p>\n<p>    author=&#39;Your Name&#39;,<\/p>\n<p>    author_email=&#39;your.email@example.com&#39;,<\/p>\n<p>    description=&#39;A simple math operations package&#39;,<\/p>\n<p>    url=&#39;https:\/\/github.com\/yourusername\/math_operations&#39;,<\/p>\n<p>    classifiers=[<\/p>\n<p>        &#39;Programming Language :: Python :: 3&#39;,<\/p>\n<p>        &#39;License :: OSI Approved :: MIT License&#39;,<\/p>\n<p>        &#39;Operating System :: OS Independent&#39;,<\/p>\n<p>    ],<\/p>\n<p>)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>4. \u751f\u6210\u5206\u53d1\u6587\u4ef6<\/h4>\n<\/p>\n<p><p>\u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python setup.py sdist bdist_wheel<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>5. \u5b89\u88c5\u548c\u6d4b\u8bd5\u5305<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528<code>pip<\/code>\u5b89\u88c5\u751f\u6210\u7684Wheel\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install dist\/math_operations-0.1-py3-none-any.whl<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6d4b\u8bd5\u5305\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from math_operations import addition, subtraction<\/p>\n<p>print(addition.add(1, 2))  # \u8f93\u51fa\uff1a3<\/p>\n<p>print(subtraction.subtract(5, 3))  # \u8f93\u51fa\uff1a2<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u4f60\u5c06\u5b66\u4f1a\u5982\u4f55\u5c06Python\u4ee3\u7801\u6253\u5305\u6210\u6587\u4ef6\uff0c\u5e76\u53d1\u5e03\u5230PyPI\u3002\u5e0c\u671b\u8fd9\u7bc7\u6587\u7ae0\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff01<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5c06Python\u4ee3\u7801\u6253\u5305\u6210\u53ef\u6267\u884c\u6587\u4ef6\uff1f<\/strong><br \/>\u6253\u5305Python\u4ee3\u7801\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\u901a\u5e38\u4f7f\u7528\u5de5\u5177\u5982PyInstaller\u3001cx_Freeze\u6216py2exe\u3002PyInstaller\u662f\u6700\u5e38\u7528\u7684\u9009\u62e9\uff0c\u5b83\u80fd\u591f\u5c06Python\u811a\u672c\u8f6c\u6362\u4e3a\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u652f\u6301Windows\u3001macOS\u548cLinux\u3002\u60a8\u53ea\u9700\u5b89\u88c5PyInstaller\uff0c\u4f7f\u7528\u547d\u4ee4\u884c\u8fdb\u5165\u9879\u76ee\u76ee\u5f55\uff0c\u7136\u540e\u8fd0\u884c<code>pyinstaller your_script.py<\/code>\uff0c\u4f1a\u5728<code>dist<\/code>\u6587\u4ef6\u5939\u5185\u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n<p><strong>\u662f\u5426\u9700\u8981\u5b89\u88c5Python\u73af\u5883\u624d\u80fd\u8fd0\u884c\u6253\u5305\u540e\u7684\u6587\u4ef6\uff1f<\/strong><br \/>\u4e0d\u9700\u8981\u3002\u4f7f\u7528PyInstaller\u6253\u5305\u540e\u7684\u53ef\u6267\u884c\u6587\u4ef6\u72ec\u7acb\u4e8ePython\u73af\u5883\uff0c\u7528\u6237\u4e0d\u9700\u8981\u5728\u4ed6\u4eec\u7684\u7cfb\u7edf\u4e0a\u5b89\u88c5Python\u6216\u4efb\u4f55\u4f9d\u8d56\u5e93\u3002\u6253\u5305\u540e\u7684\u6587\u4ef6\u5305\u542b\u4e86\u6240\u6709\u5fc5\u9700\u7684\u5e93\u548c\u8d44\u6e90\uff0c\u786e\u4fdd\u5728\u76ee\u6807\u673a\u5668\u4e0a\u80fd\u591f\u76f4\u63a5\u8fd0\u884c\u3002<\/p>\n<p><strong>\u6253\u5305\u540e\u53ef\u6267\u884c\u6587\u4ef6\u7684\u5927\u5c0f\u4f1a\u53d7\u5230\u5f71\u54cd\u5417\uff1f<\/strong><br \/>\u4f1a\u7684\u3002\u6253\u5305\u540e\u7684\u53ef\u6267\u884c\u6587\u4ef6\u901a\u5e38\u4f1a\u6bd4\u539f\u59cbPython\u811a\u672c\u6587\u4ef6\u5927\u3002\u8fd9\u662f\u56e0\u4e3a\u5b83\u5305\u542b\u4e86Python\u89e3\u91ca\u5668\u4ee5\u53ca\u6240\u6709\u4f9d\u8d56\u7684\u5e93\u548c\u8d44\u6e90\uff0c\u4ee5\u786e\u4fdd\u5728\u6ca1\u6709Python\u73af\u5883\u7684\u60c5\u51b5\u4e0b\u4e5f\u80fd\u6b63\u5e38\u5de5\u4f5c\u3002\u5c3d\u7ba1\u6587\u4ef6\u5927\u5c0f\u6709\u6240\u589e\u52a0\uff0c\u4f46\u8fd9\u4e5f\u662f\u4e3a\u4e86\u63d0\u4f9b\u66f4\u597d\u7684\u517c\u5bb9\u6027\u548c\u4fbf\u6377\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5c06Python\u4ee3\u7801\u6253\u5305\u6210\u6587\u4ef6\u7684\u6b65\u9aa4\u5305\u62ec\uff1a\u521b\u5efaPython\u5305\u3001\u4f7f\u7528setup.py\u8fdb\u884c\u6253\u5305\u3001\u751f\u6210\u53ef\u5206\u53d1\u6587\u4ef6\u3001\u5b89\u88c5 [&hellip;]","protected":false},"author":3,"featured_media":1108945,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1108939"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=1108939"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1108939\/revisions"}],"predecessor-version":[{"id":1108948,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1108939\/revisions\/1108948"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1108945"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1108939"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1108939"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1108939"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}