{"id":1162470,"date":"2025-01-15T14:43:53","date_gmt":"2025-01-15T06:43:53","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1162470.html"},"modified":"2025-01-15T14:43:56","modified_gmt":"2025-01-15T06:43:56","slug":"python%e5%a6%82%e4%bd%95%e5%ae%89%e8%a3%85%e6%b1%89%e5%8c%96%e5%8c%85","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1162470.html","title":{"rendered":"python\u5982\u4f55\u5b89\u88c5\u6c49\u5316\u5305"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25203449\/d235ed4e-602c-40b7-be97-d14996155484.webp\" alt=\"python\u5982\u4f55\u5b89\u88c5\u6c49\u5316\u5305\" \/><\/p>\n<p><p> <strong>Python\u4e2d\u5b89\u88c5\u6c49\u5316\u5305\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5982\u901a\u8fc7pip\u5b89\u88c5\u3001\u624b\u52a8\u4e0b\u8f7d\u5b89\u88c5\u3001\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93\u7b49\u3002\u6700\u5e38\u89c1\u7684\u65b9\u6cd5\u662f\u901a\u8fc7pip\u5b89\u88c5\uff0c\u56e0\u4e3a\u5b83\u7b80\u5355\u5feb\u6377\u3001\u6613\u4e8e\u7ba1\u7406\u548c\u7ef4\u62a4\u3002<\/strong><\/p>\n<\/p>\n<p><p><strong>\u8be6\u7ec6\u63cf\u8ff0\uff1a<\/strong>\u901a\u8fc7pip\u5b89\u88c5\u6c49\u5316\u5305\u7684\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u7ec8\u7aef\u6216\u547d\u4ee4\u884c\u754c\u9762\u3002<\/li>\n<li>\u8f93\u5165\u547d\u4ee4 <code>pip install &lt;\u6c49\u5316\u5305\u540d\u79f0&gt;<\/code>\uff0c\u5e76\u6309\u4e0b\u56de\u8f66\u952e\u3002<\/li>\n<li>\u7b49\u5f85\u5b89\u88c5\u5b8c\u6210\uff0c\u786e\u4fdd\u6ca1\u6709\u62a5\u9519\u4fe1\u606f\u3002<\/li>\n<li>\u5982\u679c\u9700\u8981\u6c49\u5316\u67d0\u4e2a\u7279\u5b9a\u7684Python\u5e93\uff0c\u8fd8\u9700\u8981\u5728\u4ee3\u7801\u4e2d\u8fdb\u884c\u76f8\u5e94\u7684\u914d\u7f6e\u3002<\/li>\n<\/ol>\n<p><p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u4ecb\u7ecdPython\u4e2d\u5b89\u88c5\u548c\u4f7f\u7528\u6c49\u5316\u5305\u7684\u5177\u4f53\u6b65\u9aa4\u548c\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u901a\u8fc7pip\u5b89\u88c5\u6c49\u5316\u5305<\/h3>\n<\/p>\n<p><h4>1. pip\u5b89\u88c5\u7684\u57fa\u7840<\/h4>\n<\/p>\n<p><p>pip\u662fPython\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u901a\u8fc7\u5b83\u53ef\u4ee5\u8f7b\u677e\u5730\u5b89\u88c5\u3001\u5347\u7ea7\u548c\u5220\u9664Python\u5305\u3002\u8981\u4f7f\u7528pip\u5b89\u88c5\u6c49\u5316\u5305\uff0c\u9996\u5148\u9700\u8981\u786e\u4fdd\u7cfb\u7edf\u4e2d\u5df2\u7ecf\u5b89\u88c5\u4e86pip\u3002\u5982\u679c\u6ca1\u6709\u5b89\u88c5\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5pip\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">python -m ensurepip --default-pip<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u5b89\u88c5\u6c49\u5316\u5305<\/h4>\n<\/p>\n<p><p>\u5047\u8bbe\u6211\u4eec\u8981\u5b89\u88c5\u4e00\u4e2a\u540d\u4e3a<code>example-zh<\/code>\u7684\u6c49\u5316\u5305\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip install example-zh<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6b64\u547d\u4ee4\u5c06\u4ecePython\u5305\u7d22\u5f15\uff08PyPI\uff09\u4e0b\u8f7d\u5e76\u5b89\u88c5<code>example-zh<\/code>\u5305\u3002\u5982\u679c\u5b89\u88c5\u6210\u529f\uff0c\u7ec8\u7aef\u4e2d\u4f1a\u663e\u793a\u5b89\u88c5\u8fc7\u7a0b\u548c\u6210\u529f\u4fe1\u606f\u3002<\/p>\n<\/p>\n<p><h4>3. \u9a8c\u8bc1\u5b89\u88c5<\/h4>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u9a8c\u8bc1\u5b89\u88c5\u662f\u5426\u6210\u529f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip show example-zh<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6b64\u547d\u4ee4\u5c06\u663e\u793a\u6c49\u5316\u5305\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u5305\u62ec\u7248\u672c\u53f7\u3001\u5b89\u88c5\u4f4d\u7f6e\u7b49\u3002\u5982\u679c\u663e\u793a\u4e86\u76f8\u5173\u4fe1\u606f\uff0c\u8bf4\u660e\u5b89\u88c5\u6210\u529f\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u624b\u52a8\u4e0b\u8f7d\u5b89\u88c5\u6c49\u5316\u5305<\/h3>\n<\/p>\n<p><p>\u6709\u65f6\u5019\uff0c\u6c49\u5316\u5305\u53ef\u80fd\u6ca1\u6709\u53d1\u5e03\u5230PyPI\u4e0a\uff0c\u8fd9\u65f6\u53ef\u4ee5\u9009\u62e9\u624b\u52a8\u4e0b\u8f7d\u548c\u5b89\u88c5\u3002\u4ee5\u4e0b\u662f\u5177\u4f53\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<p><h4>1. \u4e0b\u8f7d\u6c49\u5316\u5305<\/h4>\n<\/p>\n<p><p>\u4ece\u6c49\u5316\u5305\u7684\u5b98\u65b9\u7f51\u7ad9\u6216GitHub\u7b49\u8d44\u6e90\u4e0b\u8f7d\u6c49\u5316\u5305\u7684\u538b\u7f29\u6587\u4ef6\uff08\u5982<code>example-zh.zip<\/code>\u6216<code>example-zh.tar.gz<\/code>\uff09\u3002<\/p>\n<\/p>\n<p><h4>2. \u89e3\u538b\u6587\u4ef6<\/h4>\n<\/p>\n<p><p>\u5c06\u4e0b\u8f7d\u7684\u538b\u7f29\u6587\u4ef6\u89e3\u538b\u5230\u672c\u5730\u76ee\u5f55\u4e2d\u3002<\/p>\n<\/p>\n<p><h4>3. \u624b\u52a8\u5b89\u88c5<\/h4>\n<\/p>\n<p><p>\u8fdb\u5165\u89e3\u538b\u540e\u7684\u76ee\u5f55\uff0c\u6253\u5f00\u7ec8\u7aef\u6216\u547d\u4ee4\u884c\u754c\u9762\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\u6c49\u5316\u5305\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">python setup.py install<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6b64\u547d\u4ee4\u5c06\u4f1a\u81ea\u52a8\u5b89\u88c5\u6c49\u5316\u5305\u53ca\u5176\u4f9d\u8d56\u9879\u3002<\/p>\n<\/p>\n<p><h4>4. \u9a8c\u8bc1\u5b89\u88c5<\/h4>\n<\/p>\n<p><p>\u540c\u6837\uff0c\u53ef\u4ee5\u4f7f\u7528<code>pip show &lt;\u6c49\u5316\u5305\u540d\u79f0&gt;<\/code>\u547d\u4ee4\u6765\u9a8c\u8bc1\u5b89\u88c5\u662f\u5426\u6210\u529f\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93\u8fdb\u884c\u6c49\u5316<\/h3>\n<\/p>\n<p><p>\u6709\u4e9b\u7b2c\u4e09\u65b9\u5e93\u63d0\u4f9b\u4e86\u6c49\u5316\u529f\u80fd\uff0c\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u8f7b\u677e\u5730\u5c06Python\u7a0b\u5e8f\u6c49\u5316\u3002\u4ee5\u4e0b\u662f\u51e0\u4e2a\u5e38\u7528\u7684\u7b2c\u4e09\u65b9\u5e93\uff1a<\/p>\n<\/p>\n<p><h4>1. gettext\u5e93<\/h4>\n<\/p>\n<p><p><code>gettext<\/code>\u662fPython\u5185\u7f6e\u7684\u56fd\u9645\u5316\u548c\u672c\u5730\u5316\u5de5\u5177\uff0c\u53ef\u4ee5\u7528\u6765\u5b9e\u73b0\u7a0b\u5e8f\u7684\u6c49\u5316\u3002\u4ee5\u4e0b\u662f\u4f7f\u7528<code>gettext<\/code>\u5e93\u7684\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<p><p><strong>\u5b89\u88c5gettext\u5e93\uff1a<\/strong><\/p>\n<\/p>\n<p><p><code>gettext<\/code>\u662fPython\u7684\u6807\u51c6\u5e93\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5df2\u7ecf\u5b89\u88c5\u3002\u5982\u679c\u6ca1\u6709\u5b89\u88c5\uff0c\u53ef\u4ee5\u4f7f\u7528pip\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip install gettext<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u521b\u5efa.po\u6587\u4ef6\uff1a<\/strong><\/p>\n<\/p>\n<p><p>.po\u6587\u4ef6\u662f<code>gettext<\/code>\u5e93\u4f7f\u7528\u7684\u7ffb\u8bd1\u6587\u4ef6\u683c\u5f0f\u3002\u5728\u7a0b\u5e8f\u4e2d\u4f7f\u7528<code>gettext<\/code>\u65f6\uff0c\u9700\u8981\u521b\u5efa.po\u6587\u4ef6\uff0c\u5e76\u5728\u5176\u4e2d\u6dfb\u52a0\u7ffb\u8bd1\u5185\u5bb9\u3002<\/p>\n<\/p>\n<p><p><strong>\u793a\u4f8b\u4ee3\u7801\uff1a<\/strong><\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import gettext<\/p>\n<h2><strong>\u8bbe\u7f6e\u8bed\u8a00\u73af\u5883<\/strong><\/h2>\n<p>gettext.bindtextdom<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>n(&#39;example&#39;, &#39;locale&#39;)<\/p>\n<p>gettext.textdomain(&#39;example&#39;)<\/p>\n<p>lang = gettext.translation(&#39;example&#39;, localedir=&#39;locale&#39;, languages=[&#39;zh_CN&#39;])<\/p>\n<p>lang.install()<\/p>\n<h2><strong>\u4f7f\u7528\u7ffb\u8bd1<\/strong><\/h2>\n<p>_ = lang.gettext<\/p>\n<p>print(_(&quot;Hello, World!&quot;))  # \u6253\u5370\u201c\u4f60\u597d\uff0c\u4e16\u754c\uff01\u201d<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u8ff0\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u9996\u5148\u8bbe\u7f6e\u4e86\u8bed\u8a00\u73af\u5883\uff0c\u7136\u540e\u52a0\u8f7d\u4e86\u7ffb\u8bd1\u6587\u4ef6\uff0c\u6700\u540e\u4f7f\u7528<code>gettext<\/code>\u8fdb\u884c\u7ffb\u8bd1\u3002<\/p>\n<\/p>\n<p><h4>2. babel\u5e93<\/h4>\n<\/p>\n<p><p><code>Babel<\/code>\u662f\u4e00\u4e2a\u7528\u4e8ePython\u7684\u56fd\u9645\u5316\u548c\u672c\u5730\u5316\u5de5\u5177\u5e93\uff0c\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u8fdb\u884c\u65e5\u671f\u3001\u65f6\u95f4\u3001\u6570\u5b57\u7b49\u683c\u5f0f\u7684\u672c\u5730\u5316\u3002<\/p>\n<\/p>\n<p><p><strong>\u5b89\u88c5Babel\u5e93\uff1a<\/strong><\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip install babel<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u4f7f\u7528Babel\u8fdb\u884c\u65e5\u671f\u683c\u5f0f\u672c\u5730\u5316\uff1a<\/strong><\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from babel.dates import format_date<\/p>\n<p>from datetime import date<\/p>\n<h2><strong>\u8bbe\u7f6e\u8bed\u8a00\u73af\u5883<\/strong><\/h2>\n<p>locale = &#39;zh_CN&#39;<\/p>\n<h2><strong>\u683c\u5f0f\u5316\u65e5\u671f<\/strong><\/h2>\n<p>formatted_date = format_date(date.today(), format=&#39;full&#39;, locale=locale)<\/p>\n<p>print(formatted_date)  # \u6253\u5370\u201c2023\u5e7410\u670815\u65e5\u661f\u671f\u65e5\u201d<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u8ff0\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528<code>Babel<\/code>\u5e93\u683c\u5f0f\u5316\u4e86\u65e5\u671f\uff0c\u5e76\u5c06\u5176\u8f6c\u6362\u4e3a\u4e2d\u6587\u683c\u5f0f\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u914d\u7f6e\u548c\u4f7f\u7528\u6c49\u5316\u5305<\/h3>\n<\/p>\n<p><h4>1. \u914d\u7f6e\u6c49\u5316\u5305<\/h4>\n<\/p>\n<p><p>\u5b89\u88c5\u6c49\u5316\u5305\u540e\uff0c\u9700\u8981\u5728\u4ee3\u7801\u4e2d\u8fdb\u884c\u76f8\u5e94\u7684\u914d\u7f6e\uff0c\u4ee5\u4fbf\u7a0b\u5e8f\u80fd\u591f\u6b63\u786e\u52a0\u8f7d\u548c\u4f7f\u7528\u6c49\u5316\u5305\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684\u914d\u7f6e\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<p><p><strong>\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\uff1a<\/strong><\/p>\n<\/p>\n<p><p>\u6709\u4e9b\u6c49\u5316\u5305\u9700\u8981\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\uff0c\u4ee5\u6307\u5b9a\u8bed\u8a00\u73af\u5883\u548c\u7ffb\u8bd1\u6587\u4ef6\u7684\u4f4d\u7f6e\u3002\u53ef\u4ee5\u53c2\u8003\u6c49\u5316\u5305\u7684\u6587\u6863\uff0c\u627e\u5230\u76f8\u5173\u7684\u914d\u7f6e\u9009\u9879\u5e76\u8fdb\u884c\u4fee\u6539\u3002<\/p>\n<\/p>\n<p><p><strong>\u5728\u4ee3\u7801\u4e2d\u8bbe\u7f6e\u8bed\u8a00\u73af\u5883\uff1a<\/strong><\/p>\n<\/p>\n<p><p>\u53ef\u4ee5\u5728\u4ee3\u7801\u4e2d\u663e\u5f0f\u8bbe\u7f6e\u8bed\u8a00\u73af\u5883\uff0c\u4ee5\u786e\u4fdd\u7a0b\u5e8f\u80fd\u591f\u6b63\u786e\u4f7f\u7528\u6c49\u5316\u5305\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import locale<\/p>\n<h2><strong>\u8bbe\u7f6e\u8bed\u8a00\u73af\u5883\u4e3a\u4e2d\u6587<\/strong><\/h2>\n<p>locale.setlocale(locale.LC_ALL, &#39;zh_CN.UTF-8&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u4f7f\u7528\u6c49\u5316\u5305<\/h4>\n<\/p>\n<p><p>\u914d\u7f6e\u5b8c\u6210\u540e\uff0c\u5c31\u53ef\u4ee5\u5728\u4ee3\u7801\u4e2d\u4f7f\u7528\u6c49\u5316\u5305\u63d0\u4f9b\u7684\u529f\u80fd\u4e86\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684\u4f7f\u7528\u573a\u666f\uff1a<\/p>\n<\/p>\n<p><p><strong>\u754c\u9762\u6587\u5b57\u6c49\u5316\uff1a<\/strong><\/p>\n<\/p>\n<p><p>\u5982\u679c\u662f\u684c\u9762\u5e94\u7528\u7a0b\u5e8f\uff0c\u53ef\u4ee5\u4f7f\u7528\u6c49\u5316\u5305\u5c06\u754c\u9762\u6587\u5b57\u8f6c\u6362\u4e3a\u4e2d\u6587\u3002\u4f8b\u5982\uff0c\u4f7f\u7528<code>PyQt<\/code>\u5e93\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684\u7a97\u53e3\uff0c\u5e76\u5c06\u7a97\u53e3\u6807\u9898\u8bbe\u7f6e\u4e3a\u4e2d\u6587\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from PyQt5.QtWidgets import QApplication, QMainWindow<\/p>\n<p>app = QApplication([])<\/p>\n<h2><strong>\u521b\u5efa\u4e3b\u7a97\u53e3<\/strong><\/h2>\n<p>window = QMainWindow()<\/p>\n<p>window.setWindowTitle(&quot;\u4f60\u597d\uff0c\u4e16\u754c\uff01&quot;)<\/p>\n<p>window.show()<\/p>\n<p>app.exec_()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u65e5\u5fd7\u4fe1\u606f\u6c49\u5316\uff1a<\/strong><\/p>\n<\/p>\n<p><p>\u5982\u679c\u662f\u670d\u52a1\u5668\u5e94\u7528\u7a0b\u5e8f\uff0c\u53ef\u4ee5\u4f7f\u7528\u6c49\u5316\u5305\u5c06\u65e5\u5fd7\u4fe1\u606f\u8f6c\u6362\u4e3a\u4e2d\u6587\u3002\u4f8b\u5982\uff0c\u4f7f\u7528<code>logging<\/code>\u5e93\u8bb0\u5f55\u4e2d\u6587\u65e5\u5fd7\u4fe1\u606f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import logging<\/p>\n<h2><strong>\u914d\u7f6e\u65e5\u5fd7\u8bb0\u5f55\u5668<\/strong><\/h2>\n<p>logging.basicConfig(level=logging.INFO, format=&#39;%(asctime)s - %(levelname)s - %(message)s&#39;)<\/p>\n<h2><strong>\u8bb0\u5f55\u4e2d\u6587\u65e5\u5fd7\u4fe1\u606f<\/strong><\/h2>\n<p>logging.info(&quot;\u670d\u52a1\u5668\u542f\u52a8\u6210\u529f&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e94\u3001\u5e38\u89c1\u95ee\u9898\u4e0e\u89e3\u51b3\u65b9\u6848<\/h3>\n<\/p>\n<p><h4>1. \u5b89\u88c5\u5931\u8d25<\/h4>\n<\/p>\n<p><p><strong>\u95ee\u9898\u63cf\u8ff0\uff1a<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u4f7f\u7528pip\u5b89\u88c5\u6c49\u5316\u5305\u65f6\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u5b89\u88c5\u5931\u8d25\u7684\u60c5\u51b5\uff0c\u5e38\u89c1\u7684\u62a5\u9519\u4fe1\u606f\u5305\u62ec<code>Could not find a version that satisfies the requirement<\/code>\u6216<code>No matching distribution found for<\/code>\u3002<\/p>\n<\/p>\n<p><p><strong>\u89e3\u51b3\u65b9\u6848\uff1a<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u786e\u4fddpip\u7248\u672c\u4e3a\u6700\u65b0\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5347\u7ea7pip\uff1a<\/li>\n<\/ul>\n<p><pre><code class=\"language-sh\">pip install --upgrade pip<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ul>\n<li>\u68c0\u67e5\u6c49\u5316\u5305\u540d\u79f0\u662f\u5426\u6b63\u786e\uff0c\u53ef\u4ee5\u901a\u8fc7<code>pip search &lt;\u5305\u540d&gt;<\/code>\u547d\u4ee4\u641c\u7d22\u5305\u540d\u662f\u5426\u5b58\u5728\u3002<\/li>\n<li>\u5982\u679c\u6c49\u5316\u5305\u6ca1\u6709\u53d1\u5e03\u5230PyPI\u4e0a\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u624b\u52a8\u4e0b\u8f7d\u5b89\u88c5\u3002<\/li>\n<\/ul>\n<p><h4>2. \u6c49\u5316\u5305\u4e0d\u8d77\u4f5c\u7528<\/h4>\n<\/p>\n<p><p><strong>\u95ee\u9898\u63cf\u8ff0\uff1a<\/strong><\/p>\n<\/p>\n<p><p>\u5b89\u88c5\u548c\u914d\u7f6e\u6c49\u5316\u5305\u540e\uff0c\u7a0b\u5e8f\u4f9d\u7136\u6ca1\u6709\u663e\u793a\u4e2d\u6587\u3002<\/p>\n<\/p>\n<p><p><strong>\u89e3\u51b3\u65b9\u6848\uff1a<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u786e\u4fdd\u914d\u7f6e\u6587\u4ef6\u6216\u4ee3\u7801\u4e2d\u6b63\u786e\u8bbe\u7f6e\u4e86\u8bed\u8a00\u73af\u5883\u3002<\/li>\n<li>\u68c0\u67e5\u7ffb\u8bd1\u6587\u4ef6\u662f\u5426\u5b58\u5728\uff0c\u5e76\u4e14\u8def\u5f84\u662f\u5426\u6b63\u786e\u3002<\/li>\n<li>\u786e\u4fdd\u7a0b\u5e8f\u4e2d\u4f7f\u7528\u4e86\u6c49\u5316\u5305\u63d0\u4f9b\u7684\u7ffb\u8bd1\u51fd\u6570\u6216\u65b9\u6cd5\u3002<\/li>\n<\/ul>\n<p><h4>3. \u4e71\u7801\u95ee\u9898<\/h4>\n<\/p>\n<p><p><strong>\u95ee\u9898\u63cf\u8ff0\uff1a<\/strong><\/p>\n<\/p>\n<p><p>\u7a0b\u5e8f\u4e2d\u663e\u793a\u7684\u4e2d\u6587\u51fa\u73b0\u4e71\u7801\u3002<\/p>\n<\/p>\n<p><p><strong>\u89e3\u51b3\u65b9\u6848\uff1a<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u786e\u4fdd\u6e90\u4ee3\u7801\u6587\u4ef6\u4f7f\u7528UTF-8\u7f16\u7801\u4fdd\u5b58\u3002<\/li>\n<li>\u5728\u4ee3\u7801\u4e2d\u663e\u5f0f\u6307\u5b9a\u7f16\u7801\uff0c\u4f8b\u5982\u5728\u6587\u4ef6\u5f00\u5934\u6dfb\u52a0<code># -*- coding: utf-8 -*-<\/code>\u3002<\/li>\n<li>\u786e\u4fdd\u7ec8\u7aef\u6216\u547d\u4ee4\u884c\u754c\u9762\u652f\u6301\u4e2d\u6587\u663e\u793a\u3002<\/li>\n<\/ul>\n<p><h3>\u516d\u3001\u6c49\u5316\u5305\u7684\u7ba1\u7406\u4e0e\u7ef4\u62a4<\/h3>\n<\/p>\n<p><h4>1. \u5347\u7ea7\u6c49\u5316\u5305<\/h4>\n<\/p>\n<p><p>\u4e3a\u4e86\u786e\u4fdd\u6c49\u5316\u5305\u7684\u529f\u80fd\u548c\u5b89\u5168\u6027\uff0c\u5efa\u8bae\u5b9a\u671f\u5347\u7ea7\u6c49\u5316\u5305\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5347\u7ea7\u6c49\u5316\u5305\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip install --upgrade &lt;\u6c49\u5316\u5305\u540d\u79f0&gt;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6b64\u547d\u4ee4\u5c06\u4ecePyPI\u4e0b\u8f7d\u5e76\u5b89\u88c5\u6700\u65b0\u7248\u672c\u7684\u6c49\u5316\u5305\u3002<\/p>\n<\/p>\n<p><h4>2. \u5220\u9664\u6c49\u5316\u5305<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u4e0d\u518d\u9700\u8981\u67d0\u4e2a\u6c49\u5316\u5305\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5220\u9664\u5b83\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip uninstall &lt;\u6c49\u5316\u5305\u540d\u79f0&gt;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6b64\u547d\u4ee4\u5c06\u4f1a\u5220\u9664\u6307\u5b9a\u7684\u6c49\u5316\u5305\u53ca\u5176\u76f8\u5173\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h4>3. \u7ba1\u7406\u4f9d\u8d56\u9879<\/h4>\n<\/p>\n<p><p>\u5728\u9879\u76ee\u4e2d\u4f7f\u7528\u591a\u4e2a\u6c49\u5316\u5305\u65f6\uff0c\u5efa\u8bae\u4f7f\u7528<code>requirements.txt<\/code>\u6587\u4ef6\u7ba1\u7406\u4f9d\u8d56\u9879\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u751f\u6210<code>requirements.txt<\/code>\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip freeze &gt; requirements.txt<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6b64\u547d\u4ee4\u5c06\u4f1a\u751f\u6210\u5f53\u524d\u73af\u5883\u4e2d\u5df2\u5b89\u88c5\u7684\u6240\u6709\u5305\u53ca\u5176\u7248\u672c\u53f7\u5217\u8868\u3002\u901a\u8fc7<code>requirements.txt<\/code>\u6587\u4ef6\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u5728\u5176\u4ed6\u73af\u5883\u4e2d\u5b89\u88c5\u76f8\u540c\u7684\u4f9d\u8d56\u9879\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip install -r requirements.txt<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e03\u3001\u5b9e\u8df5\u6848\u4f8b<\/h3>\n<\/p>\n<p><h4>1. Flask\u5e94\u7528\u7a0b\u5e8f\u6c49\u5316<\/h4>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u4f7f\u7528Flask\u6846\u67b6\u7684\u7b80\u5355Web\u5e94\u7528\u7a0b\u5e8f\uff0c\u5e76\u5b9e\u73b0\u6c49\u5316\u529f\u80fd\u7684\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><p><strong>\u5b89\u88c5\u4f9d\u8d56\u9879\uff1a<\/strong><\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip install flask flask-babel<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u521b\u5efaFlask\u5e94\u7528\u7a0b\u5e8f\uff1a<\/strong><\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from flask import Flask, render_template<\/p>\n<p>from flask_babel import Babel, gettext<\/p>\n<p>app = Flask(__name__)<\/p>\n<h2><strong>\u914d\u7f6eBabel<\/strong><\/h2>\n<p>app.config[&#39;BABEL_DEFAULT_LOCALE&#39;] = &#39;zh_CN&#39;<\/p>\n<p>babel = Babel(app)<\/p>\n<h2><strong>\u8def\u7531\u548c\u89c6\u56fe\u51fd\u6570<\/strong><\/h2>\n<p>@app.route(&#39;\/&#39;)<\/p>\n<p>def index():<\/p>\n<p>    greeting = gettext(&#39;Hello, World!&#39;)<\/p>\n<p>    return render_template(&#39;index.html&#39;, greeting=greeting)<\/p>\n<p>if __name__ == &#39;__main__&#39;:<\/p>\n<p>    app.run(debug=True)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u521b\u5efa\u7ffb\u8bd1\u6587\u4ef6\uff1a<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u9879\u76ee\u76ee\u5f55\u4e2d\u521b\u5efa<code>translations\/zh_CN\/LC_MESSAGES\/messages.po<\/code>\u6587\u4ef6\uff0c\u5e76\u6dfb\u52a0\u7ffb\u8bd1\u5185\u5bb9\uff1a<\/p>\n<\/p>\n<p><pre><code>msgid &quot;Hello, World!&quot;<\/p>\n<p>msgstr &quot;\u4f60\u597d\uff0c\u4e16\u754c\uff01&quot;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u7f16\u8bd1\u7ffb\u8bd1\u6587\u4ef6\uff1a<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u7f16\u8bd1\u7ffb\u8bd1\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pybabel compile -d translations<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u521b\u5efa\u6a21\u677f\u6587\u4ef6\uff1a<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u9879\u76ee\u76ee\u5f55\u4e2d\u7684<code>templates<\/code>\u6587\u4ef6\u5939\u4e0b\u521b\u5efa<code>index.html<\/code>\u6587\u4ef6\uff0c\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-html\">&lt;!DOCTYPE html&gt;<\/p>\n<p>&lt;html lang=&quot;zh&quot;&gt;<\/p>\n<p>&lt;head&gt;<\/p>\n<p>    &lt;meta charset=&quot;UTF-8&quot;&gt;<\/p>\n<p>    &lt;title&gt;{{ greeting }}&lt;\/title&gt;<\/p>\n<p>&lt;\/head&gt;<\/p>\n<p>&lt;body&gt;<\/p>\n<p>    &lt;h1&gt;{{ greeting }}&lt;\/h1&gt;<\/p>\n<p>&lt;\/body&gt;<\/p>\n<p>&lt;\/html&gt;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\uff1a<\/strong><\/p>\n<\/p>\n<p><p>\u6267\u884c<code>python app.py<\/code>\u547d\u4ee4\u542f\u52a8\u5e94\u7528\u7a0b\u5e8f\uff0c\u6253\u5f00\u6d4f\u89c8\u5668\u8bbf\u95ee<code>http:\/\/127.0.0.1:5000\/<\/code>\uff0c\u5373\u53ef\u770b\u5230\u7f51\u9875\u663e\u793a\u201c\u4f60\u597d\uff0c\u4e16\u754c\uff01\u201d\u3002<\/p>\n<\/p>\n<p><h4>2. Django\u5e94\u7528\u7a0b\u5e8f\u6c49\u5316<\/h4>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u4f7f\u7528Django\u6846\u67b6\u7684\u7b80\u5355Web\u5e94\u7528\u7a0b\u5e8f\uff0c\u5e76\u5b9e\u73b0\u6c49\u5316\u529f\u80fd\u7684\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><p><strong>\u5b89\u88c5\u4f9d\u8d56\u9879\uff1a<\/strong><\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip install django django-babel<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u521b\u5efaDjango\u9879\u76ee\u548c\u5e94\u7528\uff1a<\/strong><\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">django-admin startproject myproject<\/p>\n<p>cd myproject<\/p>\n<p>django-admin startapp myapp<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u914d\u7f6eDjango\u548cBabel\uff1a<\/strong><\/p>\n<\/p>\n<p><p>\u5728<code>settings.py<\/code>\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u914d\u7f6e\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">INSTALLED_APPS = [<\/p>\n<p>    ...<\/p>\n<p>    &#39;django_babel&#39;,<\/p>\n<p>]<\/p>\n<p>LANGUAGE_CODE = &#39;zh-hans&#39;<\/p>\n<p>MIDDLEWARE = [<\/p>\n<p>    ...<\/p>\n<p>    &#39;django.middleware.locale.LocaleMiddleware&#39;,<\/p>\n<p>]<\/p>\n<p>LOCALE_PATHS = [<\/p>\n<p>    os.path.join(BASE_DIR, &#39;locale&#39;),<\/p>\n<p>]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u521b\u5efa\u89c6\u56fe\u51fd\u6570\uff1a<\/strong><\/p>\n<\/p>\n<p><p>\u5728<code>myapp\/views.py<\/code>\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from django.shortcuts import render<\/p>\n<p>from django.utils.translation import gettext as _<\/p>\n<p>def index(request):<\/p>\n<p>    greeting = _(&quot;Hello, World!&quot;)<\/p>\n<p>    return render(request, &#39;index.html&#39;, {&#39;greeting&#39;: greeting})<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u914d\u7f6eURL\uff1a<\/strong><\/p>\n<\/p>\n<p><p>\u5728<code>myapp\/urls.py<\/code>\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from django.urls import path<\/p>\n<p>from . import views<\/p>\n<p>urlpatterns = [<\/p>\n<p>    path(&#39;&#39;, views.index, name=&#39;index&#39;),<\/p>\n<p>]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728<code>myproject\/urls.py<\/code>\u6587\u4ef6\u4e2d\u5305\u542b<code>myapp<\/code>\u7684URL\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from django.contrib import admin<\/p>\n<p>from django.urls import include, path<\/p>\n<p>urlpatterns = [<\/p>\n<p>    path(&#39;admin\/&#39;, admin.site.urls),<\/p>\n<p>    path(&#39;&#39;, include(&#39;myapp.urls&#39;)),<\/p>\n<p>]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u521b\u5efa\u7ffb\u8bd1\u6587\u4ef6\uff1a<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u9879\u76ee\u76ee\u5f55\u4e2d\u521b\u5efa<code>locale\/zh_Hans\/LC_MESSAGES\/django.po<\/code>\u6587\u4ef6\uff0c\u5e76\u6dfb\u52a0\u7ffb\u8bd1\u5185\u5bb9\uff1a<\/p>\n<\/p>\n<p><pre><code>msgid &quot;Hello, World!&quot;<\/p>\n<p>msgstr &quot;\u4f60\u597d\uff0c\u4e16\u754c\uff01&quot;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u7f16\u8bd1\u7ffb\u8bd1\u6587\u4ef6\uff1a<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u7f16\u8bd1\u7ffb\u8bd1\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">django-admin compilemessages<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u521b\u5efa\u6a21\u677f\u6587\u4ef6\uff1a<\/strong><\/p>\n<\/p>\n<p><p>\u5728<code>myapp\/templates<\/code>\u6587\u4ef6\u5939\u4e0b\u521b\u5efa<code>index.html<\/code>\u6587\u4ef6\uff0c\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-html\">&lt;!DOCTYPE html&gt;<\/p>\n<p>&lt;html lang=&quot;zh&quot;&gt;<\/p>\n<p>&lt;head&gt;<\/p>\n<p>    &lt;meta charset=&quot;UTF-8&quot;&gt;<\/p>\n<p>    &lt;title&gt;{{ greeting }}&lt;\/title&gt;<\/p>\n<p>&lt;\/head&gt;<\/p>\n<p>&lt;body&gt;<\/p>\n<p>    &lt;h1&gt;{{ greeting }}&lt;\/h1&gt;<\/p>\n<p>&lt;\/body&gt;<\/p>\n<p>&lt;\/html&gt;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\uff1a<\/strong><\/p>\n<\/p>\n<p><p>\u6267\u884c<code>python manage.py runserver<\/code>\u547d\u4ee4\u542f\u52a8\u5e94\u7528\u7a0b\u5e8f\uff0c\u6253\u5f00\u6d4f\u89c8\u5668\u8bbf\u95ee<code>http:\/\/127.0.0.1:8000\/<\/code>\uff0c\u5373\u53ef\u770b\u5230\u7f51\u9875\u663e\u793a\u201c\u4f60\u597d\uff0c\u4e16\u754c\uff01\u201d\u3002<\/p>\n<\/p>\n<p><h3>\u516b\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u901a\u8fc7\u672c\u6587\u7684\u4ecb\u7ecd\uff0c\u6211\u4eec\u8be6\u7ec6\u4e86\u89e3\u4e86Python\u4e2d\u5b89\u88c5\u548c\u4f7f\u7528\u6c49\u5316\u5305\u7684\u5404\u79cd\u65b9\u6cd5\uff0c\u5305\u62ec\u901a\u8fc7pip\u5b89\u88c5\u3001\u624b\u52a8\u4e0b\u8f7d\u5b89\u88c5\u3001\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93\u4ee5\u53ca\u5b9e\u8df5\u6848\u4f8b\u7b49\u3002\u5e0c\u671b\u8fd9\u4e9b\u5185\u5bb9\u80fd\u591f\u5e2e\u52a9\u60a8\u5728\u5b9e\u9645\u9879\u76ee\u4e2d\u987a\u5229\u5b9e\u73b0\u6c49\u5316\u529f\u80fd\uff0c\u4ece\u800c\u63d0\u9ad8\u7528\u6237\u4f53\u9a8c\u548c\u5e94\u7528\u7a0b\u5e8f\u7684\u672c\u5730\u5316\u6c34\u5e73\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u5b89\u88c5\u6c49\u5316\u5305\u4ee5\u652f\u6301\u4e2d\u6587\uff1f<\/strong><br \/>\u8981\u5728Python\u4e2d\u5b89\u88c5\u6c49\u5316\u5305\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528pip\u5de5\u5177\u3002\u9996\u5148\uff0c\u786e\u4fdd\u60a8\u7684Python\u73af\u5883\u5df2\u7ecf\u914d\u7f6e\u597d\u5e76\u4e14pip\u5df2\u7ecf\u5b89\u88c5\u3002\u6253\u5f00\u7ec8\u7aef\u6216\u547d\u4ee4\u63d0\u793a\u7b26\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a  <\/p>\n<pre><code class=\"language-bash\">pip install &lt;\u6c49\u5316\u5305\u540d\u79f0&gt;\n<\/code><\/pre>\n<p>\u8bf7\u5c06\u201c&lt;\u6c49\u5316\u5305\u540d\u79f0&gt;\u201d\u66ff\u6362\u4e3a\u60a8\u8981\u5b89\u88c5\u7684\u5177\u4f53\u6c49\u5316\u5305\u7684\u540d\u79f0\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u60a8\u53ef\u4ee5\u5728\u60a8\u7684Python\u9879\u76ee\u4e2d\u5bfc\u5165\u8be5\u5305\u5e76\u5f00\u59cb\u4f7f\u7528\u4e2d\u6587\u529f\u80fd\u3002<\/p>\n<p><strong>\u5b89\u88c5\u6c49\u5316\u5305\u540e\uff0c\u5982\u4f55\u9a8c\u8bc1\u5176\u662f\u5426\u6210\u529f\uff1f<\/strong><br \/>\u53ef\u4ee5\u901a\u8fc7\u5728Python\u4ea4\u4e92\u5f0f\u73af\u5883\u4e2d\u5bfc\u5165\u6c49\u5316\u5305\u6765\u9a8c\u8bc1\u5b89\u88c5\u662f\u5426\u6210\u529f\u3002\u4f8b\u5982\uff0c\u60a8\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165\uff1a  <\/p>\n<pre><code class=\"language-python\">import &lt;\u6c49\u5316\u5305\u540d\u79f0&gt;\nprint(&lt;\u6c49\u5316\u5305\u540d\u79f0&gt;.__version__)\n<\/code><\/pre>\n<p>\u5982\u679c\u6ca1\u6709\u9519\u8bef\u63d0\u793a\u5e76\u4e14\u663e\u793a\u4e86\u7248\u672c\u53f7\uff0c\u8bf4\u660e\u6c49\u5316\u5305\u5df2\u6210\u529f\u5b89\u88c5\u5e76\u4e14\u53ef\u4ee5\u6b63\u5e38\u4f7f\u7528\u3002<\/p>\n<p><strong>\u662f\u5426\u6709\u63a8\u8350\u7684\u6c49\u5316\u5305\u9002\u7528\u4e8ePython\u7684\u7279\u5b9a\u6846\u67b6\u6216\u5e93\uff1f<\/strong><br \/>\u5bf9\u4e8e\u4e0d\u540c\u7684\u6846\u67b6\u548c\u5e93\uff0c\u6709\u4e13\u95e8\u7684\u6c49\u5316\u5305\u3002\u4f8b\u5982\uff0c\u5982\u679c\u60a8\u4f7f\u7528Django\uff0c\u53ef\u4ee5\u67e5\u627e\u201cDjango\u6c49\u5316\u5305\u201d\uff1b\u5982\u679c\u662fFlask\uff0c\u60a8\u53ef\u4ee5\u641c\u7d22\u201cFlask\u4e2d\u6587\u5305\u201d\u3002\u8fd9\u4e9b\u5305\u901a\u5e38\u4f1a\u63d0\u4f9b\u66f4\u597d\u7684\u4e2d\u6587\u652f\u6301\u548c\u7528\u6237\u6587\u6863\uff0c\u5e2e\u52a9\u60a8\u5728\u9879\u76ee\u4e2d\u66f4\u597d\u5730\u5b9e\u73b0\u4e2d\u6587\u529f\u80fd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u4e2d\u5b89\u88c5\u6c49\u5316\u5305\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5982\u901a\u8fc7pip\u5b89\u88c5\u3001\u624b\u52a8\u4e0b\u8f7d\u5b89\u88c5\u3001\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93\u7b49\u3002\u6700\u5e38\u89c1\u7684\u65b9\u6cd5\u662f\u901a\u8fc7pip [&hellip;]","protected":false},"author":3,"featured_media":1162479,"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\/1162470"}],"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=1162470"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1162470\/revisions"}],"predecessor-version":[{"id":1162480,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1162470\/revisions\/1162480"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1162479"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1162470"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1162470"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1162470"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}