{"id":1008169,"date":"2024-12-27T11:00:17","date_gmt":"2024-12-27T03:00:17","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1008169.html"},"modified":"2024-12-27T11:00:19","modified_gmt":"2024-12-27T03:00:19","slug":"python%e5%a6%82%e4%bd%95%e5%8f%91%e5%b8%83%e7%a8%8b%e5%ba%8f%e5%90%97","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1008169.html","title":{"rendered":"python\u5982\u4f55\u53d1\u5e03\u7a0b\u5e8f\u5417"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25083604\/544df56c-9534-4a41-84f0-995f7f901b5b.webp\" alt=\"python\u5982\u4f55\u53d1\u5e03\u7a0b\u5e8f\u5417\" \/><\/p>\n<p><p> <strong>Python\u7a0b\u5e8f\u7684\u53d1\u5e03\u6d89\u53ca\u591a\u4e2a\u5173\u952e\u6b65\u9aa4\uff0c\u5982\u9009\u62e9\u6b63\u786e\u7684\u53d1\u5e03\u65b9\u5f0f\u3001\u6253\u5305\u7a0b\u5e8f\u3001\u7ba1\u7406\u4f9d\u8d56\u9879\u3001\u7248\u672c\u63a7\u5236\u3001\u4e0a\u4f20\u5230\u5305\u7ba1\u7406\u5e73\u53f0\u548c\u7f16\u5199\u6587\u6863\u7b49\u3002\u9009\u62e9\u6b63\u786e\u7684\u65b9\u5f0f\u3001\u521b\u5efa\u53ef\u6267\u884c\u6587\u4ef6\u4ee5\u53ca\u5728\u4e0d\u540c\u5e73\u53f0\u4e0a\u8fdb\u884c\u6d4b\u8bd5\u662f\u5173\u952e\u6b65\u9aa4\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u53d1\u5e03Python\u7a0b\u5e8f\u3002<\/strong><\/p>\n<\/p>\n<p><p>\u4e00\u3001\u9009\u62e9\u53d1\u5e03\u65b9\u5f0f<\/p>\n<\/p>\n<p><p>\u9009\u62e9\u53d1\u5e03\u65b9\u5f0f\u662f\u53d1\u5e03Python\u7a0b\u5e8f\u7684\u7b2c\u4e00\u6b65\u3002Python\u7a0b\u5e8f\u53ef\u4ee5\u4ee5\u591a\u79cd\u65b9\u5f0f\u53d1\u5e03\uff0c\u5305\u62ec\u547d\u4ee4\u884c\u5de5\u5177\u3001\u684c\u9762\u5e94\u7528\u7a0b\u5e8f\u3001Web\u5e94\u7528\u7a0b\u5e8f\u548c\u5e93\u7b49\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u547d\u4ee4\u884c\u5de5\u5177<\/strong><br \/>\u547d\u4ee4\u884c\u5de5\u5177\u901a\u5e38\u7528\u4e8e\u6267\u884c\u7279\u5b9a\u4efb\u52a1\u6216\u811a\u672c\u3002\u8981\u53d1\u5e03\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u53ef\u4ee5\u4f7f\u7528<code>setuptools<\/code>\u6765\u5b9a\u4e49\u547d\u4ee4\u884c\u5165\u53e3\u70b9\u3002\u901a\u8fc7\u5728<code>setup.py<\/code>\u6587\u4ef6\u4e2d\u6307\u5b9a<code>entry_points<\/code>\u53c2\u6570\uff0c\u53ef\u4ee5\u521b\u5efa\u53ef\u6267\u884c\u7684\u547d\u4ee4\u884c\u5de5\u5177\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u684c\u9762\u5e94\u7528\u7a0b\u5e8f<\/strong><br \/>\u5bf9\u4e8e\u684c\u9762\u5e94\u7528\u7a0b\u5e8f\uff0c\u901a\u5e38\u9700\u8981\u5c06Python\u7a0b\u5e8f\u6253\u5305\u6210\u53ef\u6267\u884c\u6587\u4ef6\u3002\u4f7f\u7528\u5de5\u5177\u5982<code>PyInstaller<\/code>\u3001<code>cx_Freeze<\/code>\u6216<code>py2exe<\/code>\uff0c\u53ef\u4ee5\u5c06Python\u7a0b\u5e8f\u6253\u5305\u6210\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u8fd9\u6837\u7528\u6237\u65e0\u9700\u5b89\u88c5Python\u89e3\u91ca\u5668\u5373\u53ef\u8fd0\u884c\u7a0b\u5e8f\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>Web\u5e94\u7528\u7a0b\u5e8f<\/strong><br \/>Web\u5e94\u7528\u7a0b\u5e8f\u901a\u5e38\u8fd0\u884c\u5728\u670d\u52a1\u5668\u4e0a\uff0c\u901a\u8fc7\u6d4f\u89c8\u5668\u8bbf\u95ee\u3002\u53ef\u4ee5\u4f7f\u7528\u6846\u67b6\u5982Django\u3001Flask\u6216FastAPI\u6765\u5f00\u53d1\u548c\u90e8\u7f72Web\u5e94\u7528\u7a0b\u5e8f\u3002\u90e8\u7f72\u65f6\u9700\u8981\u8003\u8651\u670d\u52a1\u5668\u914d\u7f6e\u3001\u6570\u636e\u5e93\u7ba1\u7406\u548c\u5b89\u5168\u6027\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5e93<\/strong><br \/>\u5982\u679c\u8981\u53d1\u5e03Python\u5e93\uff0c\u53ef\u4ee5\u4f7f\u7528Python\u5305\u7ba1\u7406\u5de5\u5177\u5982<code>setuptools<\/code>\u6216<code>poetry<\/code>\u3002\u901a\u8fc7\u5728<code>setup.py<\/code>\u6216<code>pyproject.toml<\/code>\u6587\u4ef6\u4e2d\u5b9a\u4e49\u5305\u4fe1\u606f\uff0c\u53ef\u4ee5\u5c06\u5e93\u53d1\u5e03\u5230Python\u5305\u7ba1\u7406\u5e73\u53f0\u5982PyPI\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e8c\u3001\u6253\u5305\u7a0b\u5e8f<\/p>\n<\/p>\n<p><p>\u6253\u5305\u7a0b\u5e8f\u662f\u53d1\u5e03Python\u7a0b\u5e8f\u7684\u5173\u952e\u6b65\u9aa4\u3002\u6253\u5305\u53ef\u4ee5\u5e2e\u52a9\u7ba1\u7406\u7a0b\u5e8f\u7684\u4f9d\u8d56\u5173\u7cfb\u3001\u7248\u672c\u4fe1\u606f\u548c\u5176\u4ed6\u5143\u6570\u636e\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4f7f\u7528<code>setuptools<\/code><\/strong><br \/><code>setuptools<\/code>\u662fPython\u7684\u6807\u51c6\u6253\u5305\u5de5\u5177\uff0c\u53ef\u4ee5\u7528\u4e8e\u521b\u5efa\u6e90\u4ee3\u7801\u5206\u53d1\u548c\u4e8c\u8fdb\u5236\u5206\u53d1\u3002\u5728<code>setup.py<\/code>\u6587\u4ef6\u4e2d\u5b9a\u4e49\u5305\u7684\u540d\u79f0\u3001\u7248\u672c\u3001\u4f5c\u8005\u3001\u8bb8\u53ef\u8bc1\u7b49\u4fe1\u606f\uff0c\u5e76\u6307\u5b9a\u7a0b\u5e8f\u7684\u4f9d\u8d56\u9879\u3002<\/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;your_package_name&#39;,<\/p>\n<p>    version=&#39;0.1&#39;,<\/p>\n<p>    packages=find_packages(),<\/p>\n<p>    install_requires=[<\/p>\n<p>        &#39;some_dependency&gt;=1.0&#39;<\/p>\n<p>    ],<\/p>\n<p>)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528<code>wheel<\/code><\/strong><br \/><code>wheel<\/code>\u662fPython\u7684\u4e8c\u8fdb\u5236\u5206\u53d1\u683c\u5f0f\uff0c\u53ef\u4ee5\u52a0\u5feb\u5b89\u88c5\u901f\u5ea6\u3002\u5728\u6253\u5305\u7a0b\u5e8f\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528<code>bdist_wheel<\/code>\u547d\u4ee4\u751f\u6210<code>.whl<\/code>\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python setup.py bdist_wheel<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528<code>poetry<\/code><\/strong><br \/><code>poetry<\/code>\u662f\u73b0\u4ee3\u7684Python\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u63d0\u4f9b\u4e86\u7b80\u5355\u7684\u547d\u4ee4\u884c\u63a5\u53e3\u6765\u7ba1\u7406\u4f9d\u8d56\u5173\u7cfb\u548c\u751f\u6210\u5206\u53d1\u5305\u3002\u4f7f\u7528<code>poetry build<\/code>\u547d\u4ee4\u53ef\u4ee5\u751f\u6210\u6e90\u4ee3\u7801\u5206\u53d1\u548c\u4e8c\u8fdb\u5236\u5206\u53d1\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001\u7ba1\u7406\u4f9d\u8d56\u9879<\/p>\n<\/p>\n<p><p>\u7ba1\u7406\u4f9d\u8d56\u9879\u662f\u786e\u4fddPython\u7a0b\u5e8f\u6b63\u5e38\u8fd0\u884c\u7684\u91cd\u8981\u6b65\u9aa4\u3002\u5728\u53d1\u5e03\u7a0b\u5e8f\u65f6\uff0c\u9700\u8981\u786e\u4fdd\u6240\u6709\u4f9d\u8d56\u9879\u90fd\u5df2\u6b63\u786e\u5b89\u88c5\u5e76\u4e0e\u7a0b\u5e8f\u517c\u5bb9\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4f7f\u7528<code>requirements.txt<\/code><\/strong><br \/>\u53ef\u4ee5\u901a\u8fc7\u521b\u5efa<code>requirements.txt<\/code>\u6587\u4ef6\u6765\u5217\u51fa\u7a0b\u5e8f\u7684\u6240\u6709\u4f9d\u8d56\u9879\u3002\u4f7f\u7528<code>pip install -r requirements.txt<\/code>\u547d\u4ee4\u53ef\u4ee5\u5b89\u88c5\u8fd9\u4e9b\u4f9d\u8d56\u9879\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528<code>setup.py<\/code>\u4e2d\u7684<code>install_requires<\/code><\/strong><br \/>\u5728<code>setup.py<\/code>\u6587\u4ef6\u4e2d\u4f7f\u7528<code>install_requires<\/code>\u53c2\u6570\u6765\u6307\u5b9a\u7a0b\u5e8f\u7684\u4f9d\u8d56\u9879\u3002\u8fd9\u4e9b\u4f9d\u8d56\u9879\u5c06\u5728\u5b89\u88c5\u7a0b\u5e8f\u65f6\u81ea\u52a8\u5b89\u88c5\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528<code>poetry<\/code>\u7ba1\u7406\u4f9d\u8d56\u9879<\/strong><br \/><code>poetry<\/code>\u63d0\u4f9b\u4e86\u7b80\u5355\u7684\u547d\u4ee4\u6765\u7ba1\u7406\u4f9d\u8d56\u9879\u3002\u4f7f\u7528<code>poetry add package_name<\/code>\u547d\u4ee4\u53ef\u4ee5\u6dfb\u52a0\u4f9d\u8d56\u9879\uff0c\u5e76\u81ea\u52a8\u66f4\u65b0<code>pyproject.toml<\/code>\u6587\u4ef6\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u56db\u3001\u7248\u672c\u63a7\u5236<\/p>\n<\/p>\n<p><p>\u7248\u672c\u63a7\u5236\u662f\u8f6f\u4ef6\u5f00\u53d1\u7684\u6700\u4f73\u5b9e\u8df5\uff0c\u53ef\u4ee5\u5e2e\u52a9\u8ddf\u8e2a\u4ee3\u7801\u53d8\u5316\u5e76\u534f\u4f5c\u5f00\u53d1\u3002\u5728\u53d1\u5e03Python\u7a0b\u5e8f\u65f6\uff0c\u4f7f\u7528\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u5982Git\u662f\u975e\u5e38\u6709\u5e2e\u52a9\u7684\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4f7f\u7528Git<\/strong><br \/>Git\u662f\u6700\u5e38\u7528\u7684\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff0c\u53ef\u4ee5\u7528\u4e8e\u8ddf\u8e2a\u4ee3\u7801\u53d8\u5316\u3001\u521b\u5efa\u5206\u652f\u548c\u5408\u5e76\u4ee3\u7801\u3002\u5728\u53d1\u5e03\u7a0b\u5e8f\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528Git\u6807\u7b7e\u6765\u6807\u8bb0\u7248\u672c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">git tag v1.0<\/p>\n<p>git push origin v1.0<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u9075\u5faa\u8bed\u4e49\u5316\u7248\u672c\u53f7<\/strong><br \/>\u9075\u5faa\u8bed\u4e49\u5316\u7248\u672c\u53f7\u53ef\u4ee5\u5e2e\u52a9\u7528\u6237\u7406\u89e3\u7a0b\u5e8f\u7684\u7248\u672c\u53d8\u5316\u3002\u8bed\u4e49\u5316\u7248\u672c\u53f7\u901a\u5e38\u91c7\u7528<code>major.minor.patch<\/code>\u683c\u5f0f\uff0c\u5176\u4e2d<code>major<\/code>\u8868\u793a\u91cd\u5927\u53d8\u5316\uff0c<code>minor<\/code>\u8868\u793a\u65b0\u589e\u529f\u80fd\uff0c<code>patch<\/code>\u8868\u793a\u4fee\u590d\u9519\u8bef\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e94\u3001\u4e0a\u4f20\u5230\u5305\u7ba1\u7406\u5e73\u53f0<\/p>\n<\/p>\n<p><p>\u4e0a\u4f20\u7a0b\u5e8f\u5230\u5305\u7ba1\u7406\u5e73\u53f0\u53ef\u4ee5\u8ba9\u7528\u6237\u8f7b\u677e\u5b89\u88c5\u548c\u4f7f\u7528\u7a0b\u5e8f\u3002Python\u7684\u5b98\u65b9\u5305\u7ba1\u7406\u5e73\u53f0\u662fPython Package Index (PyPI)\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u521b\u5efaPyPI\u8d26\u6237<\/strong><br \/>\u5728\u4e0a\u4f20\u7a0b\u5e8f\u5230PyPI\u4e4b\u524d\uff0c\u9700\u8981\u521b\u5efaPyPI\u8d26\u6237\u3002\u53ef\u4ee5\u5728PyPI\u5b98\u7f51\u6ce8\u518c\u8d26\u6237\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528<code>twine<\/code>\u4e0a\u4f20\u7a0b\u5e8f<\/strong><br \/><code>twine<\/code>\u662f\u7528\u4e8e\u4e0a\u4f20Python\u5206\u53d1\u5305\u5230PyPI\u7684\u5de5\u5177\u3002\u4f7f\u7528<code>twine upload dist\/*<\/code>\u547d\u4ee4\u53ef\u4ee5\u5c06\u7a0b\u5e8f\u4e0a\u4f20\u5230PyPI\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">twine upload dist\/*<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6d4b\u8bd5\u4e0a\u4f20\u5230TestPyPI<\/strong><br \/>\u5728\u6b63\u5f0f\u4e0a\u4f20\u5230PyPI\u4e4b\u524d\uff0c\u53ef\u4ee5\u5148\u5c06\u7a0b\u5e8f\u4e0a\u4f20\u5230TestPyPI\uff0c\u8fd9\u662f\u4e00\u4e2a\u7528\u4e8e\u6d4b\u8bd5\u4e0a\u4f20\u7684\u72ec\u7acb\u5b9e\u4f8b\u3002\u4f7f\u7528<code>--repository-url<\/code>\u53c2\u6570\u53ef\u4ee5\u6307\u5b9a\u4e0a\u4f20\u5230TestPyPI\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">twine upload --repository-url https:\/\/test.pypi.org\/legacy\/ dist\/*<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u516d\u3001\u7f16\u5199\u6587\u6863<\/p>\n<\/p>\n<p><p>\u7f16\u5199\u6587\u6863\u662f\u53d1\u5e03Python\u7a0b\u5e8f\u7684\u91cd\u8981\u90e8\u5206\uff0c\u53ef\u4ee5\u5e2e\u52a9\u7528\u6237\u7406\u89e3\u548c\u4f7f\u7528\u7a0b\u5e8f\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u7f16\u5199README\u6587\u4ef6<\/strong><br \/><code>README<\/code>\u6587\u4ef6\u901a\u5e38\u662f\u7528\u6237\u4e86\u89e3\u7a0b\u5e8f\u7684\u7b2c\u4e00\u6b65\u3002\u53ef\u4ee5\u5728<code>README<\/code>\u6587\u4ef6\u4e2d\u4ecb\u7ecd\u7a0b\u5e8f\u7684\u529f\u80fd\u3001\u5b89\u88c5\u65b9\u6cd5\u3001\u4f7f\u7528\u793a\u4f8b\u548c\u8bb8\u53ef\u8bc1\u4fe1\u606f\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528\u6587\u6863\u751f\u6210\u5de5\u5177<\/strong><br \/>\u4f7f\u7528\u6587\u6863\u751f\u6210\u5de5\u5177\u5982Sphinx\u53ef\u4ee5\u751f\u6210\u4e13\u4e1a\u7684\u6587\u6863\u3002Sphinx\u652f\u6301\u591a\u79cd\u8f93\u51fa\u683c\u5f0f\uff0c\u5305\u62ecHTML\u548cPDF\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7ef4\u62a4\u6587\u6863<\/strong><br \/>\u5728\u7a0b\u5e8f\u66f4\u65b0\u65f6\uff0c\u8981\u53ca\u65f6\u66f4\u65b0\u6587\u6863\uff0c\u786e\u4fdd\u6587\u6863\u4e0e\u7a0b\u5e8f\u529f\u80fd\u4fdd\u6301\u4e00\u81f4\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u60a8\u53ef\u4ee5\u6210\u529f\u53d1\u5e03Python\u7a0b\u5e8f\u3002\u786e\u4fdd\u7a0b\u5e8f\u7ecf\u8fc7\u5145\u5206\u6d4b\u8bd5\uff0c\u5e76\u63d0\u4f9b\u8be6\u7ec6\u7684\u6587\u6863\uff0c\u4ee5\u4fbf\u7528\u6237\u80fd\u591f\u8f7b\u677e\u4f7f\u7528\u548c\u7406\u89e3\u7a0b\u5e8f\u3002\u5728\u53d1\u5e03\u8fc7\u7a0b\u4e2d\uff0c\u6ce8\u610f\u7248\u672c\u63a7\u5236\u548c\u4f9d\u8d56\u7ba1\u7406\uff0c\u4ee5\u786e\u4fdd\u7a0b\u5e8f\u7684\u7a33\u5b9a\u6027\u548c\u517c\u5bb9\u6027\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728\u4e0d\u540c\u5e73\u53f0\u4e0a\u53d1\u5e03Python\u7a0b\u5e8f\uff1f<\/strong><br \/>\u5728\u53d1\u5e03Python\u7a0b\u5e8f\u65f6\uff0c\u53ef\u4ee5\u9009\u62e9\u591a\u79cd\u5e73\u53f0\u3002\u5bf9\u4e8e\u684c\u9762\u5e94\u7528\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528PyInstaller\u6216cx_Freeze\u5c06\u7a0b\u5e8f\u6253\u5305\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u65b9\u4fbf\u7528\u6237\u76f4\u63a5\u8fd0\u884c\u3002\u5982\u679c\u662fWeb\u5e94\u7528\uff0c\u60a8\u53ef\u4ee5\u5c06\u5176\u90e8\u7f72\u5230\u4e91\u670d\u52a1\u5e73\u53f0\uff0c\u5982Heroku\u3001AWS\u6216DigitalOcean\uff0c\u786e\u4fdd\u4ee3\u7801\u80fd\u591f\u88ab\u8bbf\u95ee\u3002\u9488\u5bf9\u79fb\u52a8\u5e94\u7528\uff0c\u53ef\u4ee5\u8003\u8651\u4f7f\u7528Kivy\u6216BeeWare\uff0c\u8fd9\u4e9b\u5de5\u5177\u652f\u6301\u5c06Python\u5e94\u7528\u6253\u5305\u4e3aiOS\u6216Android\u5e94\u7528\u3002<\/p>\n<p><strong>\u53d1\u5e03Python\u7a0b\u5e8f\u65f6\u9700\u8981\u6ce8\u610f\u54ea\u4e9b\u4f9d\u8d56\u9879\uff1f<\/strong><br \/>\u5728\u53d1\u5e03\u7a0b\u5e8f\u4e4b\u524d\uff0c\u786e\u4fdd\u6240\u6709\u4f9d\u8d56\u9879\u90fd\u5df2\u5217\u51fa\u5e76\u6b63\u786e\u5b89\u88c5\u3002\u4f7f\u7528requirements.txt\u6587\u4ef6\u53ef\u4ee5\u65b9\u4fbf\u5730\u7ba1\u7406\u548c\u5b89\u88c5\u4f9d\u8d56\u3002\u901a\u8fc7\u8fd0\u884c<code>pip freeze &gt; requirements.txt<\/code>\u5c06\u5f53\u524d\u73af\u5883\u4e2d\u7684\u6240\u6709\u5305\u8bb0\u5f55\u4e0b\u6765\uff0c\u7528\u6237\u5728\u5b89\u88c5\u60a8\u7684\u7a0b\u5e8f\u65f6\u53ea\u9700\u8fd0\u884c<code>pip install -r requirements.txt<\/code>\u5373\u53ef\u5b89\u88c5\u6240\u9700\u7684\u4f9d\u8d56\u3002\u6b64\u5916\uff0c\u786e\u4fdd\u5728\u6587\u6863\u4e2d\u63d0\u4f9b\u6e05\u6670\u7684\u5b89\u88c5\u6b65\u9aa4\u548c\u73af\u5883\u8981\u6c42\u3002<\/p>\n<p><strong>\u5982\u4f55\u6709\u6548\u5730\u7ba1\u7406Python\u7a0b\u5e8f\u7684\u7248\u672c\uff1f<\/strong><br \/>\u7248\u672c\u7ba1\u7406\u5bf9\u4e8e\u53d1\u5e03\u548c\u7ef4\u62a4Python\u7a0b\u5e8f\u81f3\u5173\u91cd\u8981\u3002\u4f7f\u7528Git\u7b49\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u53ef\u4ee5\u8f7b\u677e\u8ddf\u8e2a\u4ee3\u7801\u7684\u53d8\u5316\u548c\u66f4\u65b0\u3002\u60a8\u8fd8\u53ef\u4ee5\u5728\u9879\u76ee\u4e2d\u4f7f\u7528\u7248\u672c\u53f7\u89c4\u8303\uff08\u5982Semantic Versioning\uff09\u6765\u6e05\u6670\u5730\u6807\u8bc6\u6bcf\u4e2a\u7248\u672c\u7684\u53d8\u5316\u3002\u53d1\u5e03\u65f6\uff0c\u5efa\u8bae\u5728\u6587\u6863\u4e2d\u8be6\u7ec6\u8bf4\u660e\u6bcf\u4e2a\u7248\u672c\u7684\u65b0\u7279\u6027\u3001\u4fee\u590d\u7684bug\u53ca\u5df2\u77e5\u95ee\u9898\uff0c\u4ee5\u5e2e\u52a9\u7528\u6237\u66f4\u597d\u5730\u7406\u89e3\u66f4\u65b0\u5185\u5bb9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u7a0b\u5e8f\u7684\u53d1\u5e03\u6d89\u53ca\u591a\u4e2a\u5173\u952e\u6b65\u9aa4\uff0c\u5982\u9009\u62e9\u6b63\u786e\u7684\u53d1\u5e03\u65b9\u5f0f\u3001\u6253\u5305\u7a0b\u5e8f\u3001\u7ba1\u7406\u4f9d\u8d56\u9879\u3001\u7248\u672c\u63a7\u5236\u3001\u4e0a\u4f20\u5230\u5305\u7ba1\u7406\u5e73\u53f0 [&hellip;]","protected":false},"author":3,"featured_media":1008175,"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\/1008169"}],"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=1008169"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1008169\/revisions"}],"predecessor-version":[{"id":1008178,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1008169\/revisions\/1008178"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1008175"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1008169"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1008169"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1008169"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}