{"id":1178069,"date":"2025-01-15T18:05:51","date_gmt":"2025-01-15T10:05:51","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1178069.html"},"modified":"2025-01-15T18:05:53","modified_gmt":"2025-01-15T10:05:53","slug":"%e5%a6%82%e4%bd%95%e9%85%8d%e7%bd%ae%e7%8e%af%e5%a2%83%e5%8f%98%e9%87%8fpython","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1178069.html","title":{"rendered":"\u5982\u4f55\u914d\u7f6e\u73af\u5883\u53d8\u91cfPython"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25112817\/dad30073-535b-4760-bfb8-8fa2aaf85037.webp\" alt=\"\u5982\u4f55\u914d\u7f6e\u73af\u5883\u53d8\u91cfPython\" \/><\/p>\n<p><p> <strong>\u914d\u7f6e\u73af\u5883\u53d8\u91cfPython\u7684\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528\u64cd\u4f5c\u7cfb\u7edf\u63d0\u4f9b\u7684\u5de5\u5177\u3001\u901a\u8fc7Python\u811a\u672c\u8bbe\u7f6e\u3001\u4f7f\u7528\u865a\u62df\u73af\u5883\u5de5\u5177\u3001\u901a\u8fc7IDE\u914d\u7f6e<\/strong>\u3002\u4e0b\u9762\u6211\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u901a\u8fc7\u64cd\u4f5c\u7cfb\u7edf\u63d0\u4f9b\u7684\u5de5\u5177\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u7684\u5177\u4f53\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><p><strong>\u901a\u8fc7\u64cd\u4f5c\u7cfb\u7edf\u63d0\u4f9b\u7684\u5de5\u5177\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/strong><\/p>\n<\/p>\n<p><p>\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u6765\u914d\u7f6e\u73af\u5883\u53d8\u91cf\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u53f3\u952e\u70b9\u51fb\u201c\u6b64\u7535\u8111\u201d\u6216\u201c\u6211\u7684\u7535\u8111\u201d\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d\u3002<\/li>\n<li>\u70b9\u51fb\u201c\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e\u201d\uff0c\u8fdb\u5165\u201c\u7cfb\u7edf\u5c5e\u6027\u201d\u7a97\u53e3\u3002<\/li>\n<li>\u70b9\u51fb\u201c\u73af\u5883\u53d8\u91cf\u201d\u6309\u94ae\u3002<\/li>\n<li>\u5728\u201c\u7cfb\u7edf\u53d8\u91cf\u201d\u6216\u201c\u7528\u6237\u53d8\u91cf\u201d\u4e2d\u627e\u5230\u8981\u4fee\u6539\u7684\u53d8\u91cf\uff08\u5982PATH\uff09\uff0c\u7136\u540e\u70b9\u51fb\u201c\u7f16\u8f91\u201d\u3002<\/li>\n<li>\u5728\u53d8\u91cf\u503c\u4e2d\u6dfb\u52a0Python\u7684\u5b89\u88c5\u8def\u5f84\uff08\u4f8b\u5982C:\\Python39\uff09\uff0c\u591a\u4e2a\u8def\u5f84\u4e4b\u95f4\u7528\u5206\u53f7\u5206\u9694\u3002<\/li>\n<li>\u70b9\u51fb\u201c\u786e\u5b9a\u201d\u4fdd\u5b58\u8bbe\u7f6e\u3002<\/li>\n<\/ol>\n<p><p>\u5728Linux\u6216macOS\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539shell\u914d\u7f6e\u6587\u4ef6\u6765\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u7ec8\u7aef\u3002<\/li>\n<li>\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00shell\u914d\u7f6e\u6587\u4ef6\uff08\u5982.bashrc\u3001.bash_profile\u3001.zshrc\u7b49\uff09\uff0c\u4f8b\u5982\uff1a<code>nano ~\/.bashrc<\/code>\u3002<\/li>\n<li>\u5728\u6587\u4ef6\u672b\u5c3e\u6dfb\u52a0\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u547d\u4ee4\uff0c\u4f8b\u5982\uff1a<code>export PATH=$PATH:\/usr\/local\/bin\/python3<\/code>\u3002<\/li>\n<li>\u4fdd\u5b58\u6587\u4ef6\u5e76\u9000\u51fa\u7f16\u8f91\u5668\u3002<\/li>\n<li>\u4f7f\u914d\u7f6e\u6587\u4ef6\u751f\u6548\uff1a<code>source ~\/.bashrc<\/code>\u3002<\/li>\n<\/ol>\n<p><p>\u63a5\u4e0b\u6765\uff0c\u6211\u5c06\u8fdb\u4e00\u6b65\u63a2\u8ba8\u5176\u4ed6\u65b9\u6cd5\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u7684\u8be6\u7ec6\u6b65\u9aa4\u548c\u6ce8\u610f\u4e8b\u9879\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528\u64cd\u4f5c\u7cfb\u7edf\u63d0\u4f9b\u7684\u5de5\u5177<\/h3>\n<\/p>\n<p><h4>1. Windows\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u7684\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u8bbf\u95ee\u7cfb\u7edf\u5c5e\u6027<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u53f3\u952e\u70b9\u51fb\u201c\u6b64\u7535\u8111\u201d\u6216\u201c\u6211\u7684\u7535\u8111\u201d\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d\u3002<\/li>\n<li>\u5728\u5f39\u51fa\u7684\u7a97\u53e3\u4e2d\uff0c\u70b9\u51fb\u5de6\u4fa7\u7684\u201c\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e\u201d\uff0c\u8fdb\u5165\u201c\u7cfb\u7edf\u5c5e\u6027\u201d\u7a97\u53e3\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u6253\u5f00\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u5728\u201c\u7cfb\u7edf\u5c5e\u6027\u201d\u7a97\u53e3\u4e2d\uff0c\u70b9\u51fb\u201c\u73af\u5883\u53d8\u91cf\u201d\u6309\u94ae\uff0c\u8fdb\u5165\u201c\u73af\u5883\u53d8\u91cf\u201d\u7a97\u53e3\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u7f16\u8f91\u7cfb\u7edf\u53d8\u91cf\u6216\u7528\u6237\u53d8\u91cf<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u5728\u201c\u73af\u5883\u53d8\u91cf\u201d\u7a97\u53e3\u4e2d\uff0c\u53ef\u4ee5\u9009\u62e9\u7f16\u8f91\u201c\u7cfb\u7edf\u53d8\u91cf\u201d\u6216\u201c\u7528\u6237\u53d8\u91cf\u201d\u3002<\/li>\n<li>\u627e\u5230\u8981\u4fee\u6539\u7684\u53d8\u91cf\uff08\u5982PATH\uff09\uff0c\u7136\u540e\u70b9\u51fb\u201c\u7f16\u8f91\u201d\u3002\u5982\u679c\u53d8\u91cf\u4e0d\u5b58\u5728\uff0c\u53ef\u4ee5\u70b9\u51fb\u201c\u65b0\u5efa\u201d\u6765\u521b\u5efa\u65b0\u7684\u53d8\u91cf\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u6dfb\u52a0Python\u8def\u5f84<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u5728\u53d8\u91cf\u503c\u4e2d\u6dfb\u52a0Python\u7684\u5b89\u88c5\u8def\u5f84\uff08\u4f8b\u5982C:\\Python39\uff09\uff0c\u591a\u4e2a\u8def\u5f84\u4e4b\u95f4\u7528\u5206\u53f7\u5206\u9694\u3002<\/li>\n<li>\u70b9\u51fb\u201c\u786e\u5b9a\u201d\u4fdd\u5b58\u8bbe\u7f6e\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u9a8c\u8bc1\u8bbe\u7f6e<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff0c\u8f93\u5165<code>python<\/code>\u547d\u4ee4\uff0c\u68c0\u67e5\u662f\u5426\u6210\u529f\u914d\u7f6e\u3002\u5982\u679c\u80fd\u591f\u6210\u529f\u542f\u52a8Python\u89e3\u91ca\u5668\uff0c\u5219\u8bf4\u660e\u914d\u7f6e\u6210\u529f\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><h4>2. Linux\u6216macOS\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728Linux\u6216macOS\u7cfb\u7edf\u4e2d\uff0c\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u7684\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6253\u5f00\u7ec8\u7aef<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u6253\u5f00\u7ec8\u7aef\u7a97\u53e3\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u7f16\u8f91shell\u914d\u7f6e\u6587\u4ef6<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00shell\u914d\u7f6e\u6587\u4ef6\uff08\u5982.bashrc\u3001.bash_profile\u3001.zshrc\u7b49\uff09\u3002\u4ee5nano\u4e3a\u4f8b\uff1a<code>nano ~\/.bashrc<\/code>\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u6dfb\u52a0\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u547d\u4ee4<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u5728\u6587\u4ef6\u672b\u5c3e\u6dfb\u52a0\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u547d\u4ee4\uff0c\u4f8b\u5982\uff1a<code>export PATH=$PATH:\/usr\/local\/bin\/python3<\/code>\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u4fdd\u5b58\u6587\u4ef6\u5e76\u9000\u51fa\u7f16\u8f91\u5668<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u6309<code>Ctrl + O<\/code>\u4fdd\u5b58\u6587\u4ef6\uff0c\u6309<code>Ctrl + X<\/code>\u9000\u51fa\u7f16\u8f91\u5668\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u4f7f\u914d\u7f6e\u6587\u4ef6\u751f\u6548<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u8fd0\u884c\u547d\u4ee4<code>source ~\/.bashrc<\/code>\u4f7f\u914d\u7f6e\u6587\u4ef6\u751f\u6548\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u9a8c\u8bc1\u8bbe\u7f6e<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165<code>python3<\/code>\u547d\u4ee4\uff0c\u68c0\u67e5\u662f\u5426\u6210\u529f\u914d\u7f6e\u3002\u5982\u679c\u80fd\u591f\u6210\u529f\u542f\u52a8Python\u89e3\u91ca\u5668\uff0c\u5219\u8bf4\u660e\u914d\u7f6e\u6210\u529f\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><h3>\u4e8c\u3001\u901a\u8fc7Python\u811a\u672c\u8bbe\u7f6e<\/h3>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u53ef\u80fd\u5e0c\u671b\u5728\u8fd0\u884cPython\u811a\u672c\u65f6\u52a8\u6001\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3002\u53ef\u4ee5\u4f7f\u7528Python\u7684<code>os<\/code>\u6a21\u5757\u6765\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import os<\/p>\n<h2><strong>\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<\/strong><\/h2>\n<p>os.environ[&#39;MY_VARIABLE&#39;] = &#39;my_value&#39;<\/p>\n<h2><strong>\u83b7\u53d6\u73af\u5883\u53d8\u91cf<\/strong><\/h2>\n<p>print(os.environ.get(&#39;MY_VARIABLE&#39;))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e0a\u9762\u7684\u4ee3\u7801\u8bbe\u7f6e\u4e86\u4e00\u4e2a\u73af\u5883\u53d8\u91cf<code>MY_VARIABLE<\/code>\uff0c\u5e76\u6253\u5370\u5176\u503c\u3002\u4f7f\u7528\u8fd9\u79cd\u65b9\u6cd5\uff0c\u53ef\u4ee5\u5728\u811a\u672c\u8fd0\u884c\u65f6\u52a8\u6001\u8bbe\u7f6e\u548c\u83b7\u53d6\u73af\u5883\u53d8\u91cf\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528\u865a\u62df\u73af\u5883\u5de5\u5177<\/h3>\n<\/p>\n<p><p>\u865a\u62df\u73af\u5883\u5de5\u5177\uff08\u5982venv\u3001virtualenv\uff09\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u521b\u5efa\u9694\u79bb\u7684Python\u73af\u5883\uff0c\u5e76\u81ea\u52a8\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u3002\u5728\u865a\u62df\u73af\u5883\u4e2d\uff0c\u53ef\u4ee5\u5b89\u88c5\u7279\u5b9a\u7248\u672c\u7684Python\u5305\uff0c\u800c\u4e0d\u5f71\u54cd\u7cfb\u7edf\u7684\u5168\u5c40\u73af\u5883\u3002<\/p>\n<\/p>\n<p><h4>1. \u521b\u5efa\u865a\u62df\u73af\u5883<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528<code>venv<\/code>\u521b\u5efa\u865a\u62df\u73af\u5883\u7684\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5b89\u88c5venv\u6a21\u5757<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u5728Python 3.3\u53ca\u4ee5\u4e0a\u7248\u672c\u4e2d\uff0c<code>venv<\/code>\u6a21\u5757\u662f\u5185\u7f6e\u7684\uff0c\u65e0\u9700\u5b89\u88c5\u3002<\/li>\n<li>\u5bf9\u4e8ePython 3.3\u4ee5\u4e0b\u7248\u672c\uff0c\u53ef\u4ee5\u4f7f\u7528<code>virtualenv<\/code>\u5de5\u5177\uff1a<code>pip install virtualenv<\/code>\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u521b\u5efa\u865a\u62df\u73af\u5883<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u6253\u5f00\u7ec8\u7aef\u6216\u547d\u4ee4\u63d0\u793a\u7b26\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u521b\u5efa\u865a\u62df\u73af\u5883\uff1a\n<pre><code class=\"language-sh\">python -m venv myenv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u4e0a\u8ff0\u547d\u4ee4\u5c06\u5728\u5f53\u524d\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code>myenv<\/code>\u7684\u865a\u62df\u73af\u5883\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u6fc0\u6d3b\u865a\u62df\u73af\u5883<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6fc0\u6d3b\u865a\u62df\u73af\u5883\uff1a\n<pre><code class=\"language-sh\">myenv\\Scripts\\activate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u5728Linux\u6216macOS\u7cfb\u7edf\u4e2d\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6fc0\u6d3b\u865a\u62df\u73af\u5883\uff1a\n<pre><code class=\"language-sh\">source myenv\/bin\/activate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5\u4f9d\u8d56\u5305<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528<code>pip<\/code>\u547d\u4ee4\u5b89\u88c5\u6240\u9700\u7684Python\u5305\uff1a\n<pre><code class=\"language-sh\">pip install package_name<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528\u865a\u62df\u73af\u5883<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u540e\uff0c\u53ef\u4ee5\u5728\u5176\u4e2d\u8fd0\u884cPython\u811a\u672c\u3002\u865a\u62df\u73af\u5883\u4f1a\u81ea\u52a8\u914d\u7f6e\u73af\u5883\u53d8\u91cf\uff0c\u4f7f\u5176\u4f7f\u7528\u865a\u62df\u73af\u5883\u4e2d\u7684Python\u89e3\u91ca\u5668\u548c\u5305\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u9000\u51fa\u865a\u62df\u73af\u5883<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u4f7f\u7528\u5b8c\u865a\u62df\u73af\u5883\u540e\uff0c\u53ef\u4ee5\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u9000\u51fa\u865a\u62df\u73af\u5883\uff1a\n<pre><code class=\"language-sh\">deactivate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><h4>2. \u4f7f\u7528virtualenvwrapper\u5de5\u5177<\/h4>\n<\/p>\n<p><p><code>virtualenvwrapper<\/code>\u662f\u4e00\u4e2a\u7528\u4e8e\u7ba1\u7406\u865a\u62df\u73af\u5883\u7684\u5de5\u5177\uff0c\u63d0\u4f9b\u4e86\u66f4\u65b9\u4fbf\u7684\u547d\u4ee4\u6765\u521b\u5efa\u3001\u6fc0\u6d3b\u548c\u5220\u9664\u865a\u62df\u73af\u5883\u3002\u4f7f\u7528<code>virtualenvwrapper<\/code>\u7684\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5b89\u88c5virtualenvwrapper<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u4f7f\u7528<code>pip<\/code>\u547d\u4ee4\u5b89\u88c5<code>virtualenvwrapper<\/code>\uff1a\n<pre><code class=\"language-sh\">pip install virtualenvwrapper<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u914d\u7f6eshell\u914d\u7f6e\u6587\u4ef6<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u6253\u5f00shell\u914d\u7f6e\u6587\u4ef6\uff08\u5982.bashrc\u3001.bash_profile\u3001.zshrc\u7b49\uff09\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a\n<pre><code class=\"language-sh\">export WORKON_HOME=$HOME\/.virtualenvs<\/p>\n<p>source \/usr\/local\/bin\/virtualenvwrapper.sh<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u4fdd\u5b58\u6587\u4ef6\u5e76\u4f7f\u5176\u751f\u6548\uff1a<code>source ~\/.bashrc<\/code>\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u521b\u5efa\u865a\u62df\u73af\u5883<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u4f7f\u7528<code>mkvirtualenv<\/code>\u547d\u4ee4\u521b\u5efa\u865a\u62df\u73af\u5883\uff1a\n<pre><code class=\"language-sh\">mkvirtualenv myenv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u6fc0\u6d3b\u865a\u62df\u73af\u5883<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u4f7f\u7528<code>workon<\/code>\u547d\u4ee4\u6fc0\u6d3b\u865a\u62df\u73af\u5883\uff1a\n<pre><code class=\"language-sh\">workon myenv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u7ba1\u7406\u865a\u62df\u73af\u5883<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u4f7f\u7528<code>lsvirtualenv<\/code>\u547d\u4ee4\u5217\u51fa\u6240\u6709\u865a\u62df\u73af\u5883\uff1a\n<pre><code class=\"language-sh\">lsvirtualenv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u4f7f\u7528<code>rmvirtualenv<\/code>\u547d\u4ee4\u5220\u9664\u865a\u62df\u73af\u5883\uff1a\n<pre><code class=\"language-sh\">rmvirtualenv myenv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><h3>\u56db\u3001\u901a\u8fc7IDE\u914d\u7f6e<\/h3>\n<\/p>\n<p><p>\u73b0\u4ee3\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u5982PyCharm\u3001VS Code\u7b49\uff0c\u63d0\u4f9b\u4e86\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u7684\u529f\u80fd\uff0c\u53ef\u4ee5\u5728\u5f00\u53d1\u65f6\u81ea\u52a8\u8bbe\u7f6e\u6240\u9700\u7684\u73af\u5883\u53d8\u91cf\u3002<\/p>\n<\/p>\n<p><h4>1. PyCharm<\/h4>\n<\/p>\n<p><p>\u5728PyCharm\u4e2d\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u7684\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6253\u5f00\u9879\u76ee\u8bbe\u7f6e<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u6253\u5f00PyCharm\uff0c\u9009\u62e9\u8981\u914d\u7f6e\u7684\u9879\u76ee\u3002<\/li>\n<li>\u70b9\u51fb\u83dc\u5355\u680f\u4e2d\u7684\u201cFile\u201d\uff0c\u9009\u62e9\u201cSettings\u201d\u6216\u201cPreferences\u201d\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u914d\u7f6e\u8fd0\u884c\/\u8c03\u8bd5\u914d\u7f6e<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u5728\u8bbe\u7f6e\u7a97\u53e3\u4e2d\uff0c\u9009\u62e9\u201cRun\/Debug Configurations\u201d\u3002<\/li>\n<li>\u5728\u53f3\u4fa7\u7a97\u53e3\u4e2d\uff0c\u9009\u62e9\u8981\u914d\u7f6e\u7684\u8fd0\u884c\/\u8c03\u8bd5\u914d\u7f6e\uff0c\u6216\u521b\u5efa\u65b0\u7684\u914d\u7f6e\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u5728\u201cEnvironment Variables\u201d\u5b57\u6bb5\u4e2d\uff0c\u70b9\u51fb\u53f3\u4fa7\u7684\u201c&#8230;\u201d\u6309\u94ae\u3002<\/li>\n<li>\u5728\u5f39\u51fa\u7684\u7a97\u53e3\u4e2d\uff0c\u70b9\u51fb\u201c+\u201d\u6309\u94ae\uff0c\u6dfb\u52a0\u6240\u9700\u7684\u73af\u5883\u53d8\u91cf\u53ca\u5176\u503c\u3002<\/li>\n<li>\u70b9\u51fb\u201cOK\u201d\u4fdd\u5b58\u8bbe\u7f6e\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u8fd0\u884c\u9879\u76ee<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u914d\u7f6e\u5b8c\u6210\u540e\uff0c\u8fd0\u884c\u9879\u76ee\u65f6\u4f1a\u81ea\u52a8\u4f7f\u7528\u8bbe\u7f6e\u7684\u73af\u5883\u53d8\u91cf\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><h4>2. VS Code<\/h4>\n<\/p>\n<p><p>\u5728VS Code\u4e2d\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u7684\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6253\u5f00\u9879\u76ee\u6587\u4ef6\u5939<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u6253\u5f00VS Code\uff0c\u9009\u62e9\u8981\u914d\u7f6e\u7684\u9879\u76ee\u6587\u4ef6\u5939\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u7f16\u8f91launch.json\u6587\u4ef6<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u70b9\u51fb\u5de6\u4fa7\u6d3b\u52a8\u680f\u4e2d\u7684\u201cRun and Debug\u201d\u56fe\u6807\uff0c\u9009\u62e9\u201ccreate a launch.json file\u201d\u3002<\/li>\n<li>\u5728\u5f39\u51fa\u7684\u6587\u4ef6\u4e2d\uff0c\u6dfb\u52a0<code>env<\/code>\u5b57\u6bb5\uff0c\u7528\u4e8e\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\uff0c\u4f8b\u5982\uff1a\n<pre><code class=\"language-json\">{<\/p>\n<p>  &quot;version&quot;: &quot;0.2.0&quot;,<\/p>\n<p>  &quot;configurations&quot;: [<\/p>\n<p>    {<\/p>\n<p>      &quot;name&quot;: &quot;Python: Current File&quot;,<\/p>\n<p>      &quot;type&quot;: &quot;python&quot;,<\/p>\n<p>      &quot;request&quot;: &quot;launch&quot;,<\/p>\n<p>      &quot;program&quot;: &quot;${file}&quot;,<\/p>\n<p>      &quot;console&quot;: &quot;integratedTerminal&quot;,<\/p>\n<p>      &quot;env&quot;: {<\/p>\n<p>        &quot;MY_VARIABLE&quot;: &quot;my_value&quot;<\/p>\n<p>      }<\/p>\n<p>    }<\/p>\n<p>  ]<\/p>\n<p>}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u8fd0\u884c\u9879\u76ee<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u914d\u7f6e\u5b8c\u6210\u540e\uff0c\u8fd0\u884c\u9879\u76ee\u65f6\u4f1a\u81ea\u52a8\u4f7f\u7528\u8bbe\u7f6e\u7684\u73af\u5883\u53d8\u91cf\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><h3>\u4e94\u3001\u5e38\u89c1\u95ee\u9898\u548c\u89e3\u51b3\u65b9\u6cd5<\/h3>\n<\/p>\n<p><h4>1. \u73af\u5883\u53d8\u91cf\u672a\u751f\u6548<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u540e\u672a\u751f\u6548\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u4ee5\u4e0b\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u68c0\u67e5\u914d\u7f6e\u662f\u5426\u6b63\u786e<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u786e\u4fdd\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u8bed\u6cd5\u6b63\u786e\uff0c\u8def\u5f84\u65e0\u8bef\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u4f7f\u914d\u7f6e\u6587\u4ef6\u751f\u6548<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u5728Linux\u6216macOS\u7cfb\u7edf\u4e2d\uff0c\u8fd0\u884c\u547d\u4ee4<code>source ~\/.bashrc<\/code>\u4f7f\u914d\u7f6e\u6587\u4ef6\u751f\u6548\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u91cd\u542f\u7ec8\u7aef\u6216IDE<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u5173\u95ed\u5e76\u91cd\u65b0\u6253\u5f00\u7ec8\u7aef\u6216IDE\uff0c\u786e\u4fdd\u65b0\u914d\u7f6e\u751f\u6548\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u68c0\u67e5\u73af\u5883\u53d8\u91cf\u51b2\u7a81<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u68c0\u67e5\u662f\u5426\u5b58\u5728\u540c\u540d\u7684\u73af\u5883\u53d8\u91cf\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u51b2\u7a81\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><h4>2. Python\u89e3\u91ca\u5668\u65e0\u6cd5\u627e\u5230\u5305<\/h4>\n<\/p>\n<p><p>\u5982\u679cPython\u89e3\u91ca\u5668\u65e0\u6cd5\u627e\u5230\u5df2\u5b89\u88c5\u7684\u5305\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u4ee5\u4e0b\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u68c0\u67e5\u865a\u62df\u73af\u5883\u662f\u5426\u6fc0\u6d3b<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u786e\u4fdd\u865a\u62df\u73af\u5883\u5df2\u6fc0\u6d3b\uff0c\u4f7f\u7528<code>pip list<\/code>\u547d\u4ee4\u68c0\u67e5\u5305\u662f\u5426\u5df2\u5b89\u88c5\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u68c0\u67e5\u73af\u5883\u53d8\u91cf\u914d\u7f6e<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u786e\u4fdd\u73af\u5883\u53d8\u91cfPATH\u4e2d\u5305\u542bPython\u89e3\u91ca\u5668\u7684\u8def\u5f84\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u91cd\u65b0\u5b89\u88c5\u5305<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u5728\u865a\u62df\u73af\u5883\u4e2d\u91cd\u65b0\u5b89\u88c5\u6240\u9700\u7684\u5305\uff1a<code>pip install package_name<\/code>\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><h3>\u516d\u3001\u73af\u5883\u53d8\u91cf\u7684\u6700\u4f73\u5b9e\u8df5<\/h3>\n<\/p>\n<p><p>\u5728\u4f7f\u7528\u73af\u5883\u53d8\u91cf\u65f6\uff0c\u53ef\u4ee5\u9075\u5faa\u4ee5\u4e0b\u6700\u4f73\u5b9e\u8df5\uff1a<\/p>\n<\/p>\n<p><h4>1. \u907f\u514d\u786c\u7f16\u7801<\/h4>\n<\/p>\n<p><p>\u907f\u514d\u5728\u4ee3\u7801\u4e2d\u786c\u7f16\u7801\u73af\u5883\u53d8\u91cf\uff0c\u4f7f\u7528\u914d\u7f6e\u6587\u4ef6\u6216\u73af\u5883\u53d8\u91cf\u7ba1\u7406\u5de5\u5177\u6765\u7ba1\u7406\u73af\u5883\u53d8\u91cf\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u4f7f\u7528<code>.env<\/code>\u6587\u4ef6\u6765\u5b58\u50a8\u73af\u5883\u53d8\u91cf\uff0c\u5e76\u4f7f\u7528<code>python-dotenv<\/code>\u5e93\u52a0\u8f7d\u73af\u5883\u53d8\u91cf\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\"># .env\u6587\u4ef6<\/p>\n<p>MY_VARIABLE=my_value<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><pre><code class=\"language-python\"># \u52a0\u8f7d.env\u6587\u4ef6\u4e2d\u7684\u73af\u5883\u53d8\u91cf<\/p>\n<p>from dotenv import load_dotenv<\/p>\n<p>import os<\/p>\n<p>load_dotenv()<\/p>\n<p>print(os.environ.get(&#39;MY_VARIABLE&#39;))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u4f7f\u7528\u524d\u7f00<\/h4>\n<\/p>\n<p><p>\u4e3a\u73af\u5883\u53d8\u91cf\u4f7f\u7528\u524d\u7f00\uff0c\u4ee5\u907f\u514d\u4e0e\u5176\u4ed6\u73af\u5883\u53d8\u91cf\u51b2\u7a81\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u4e3a\u9879\u76ee\u7684\u73af\u5883\u53d8\u91cf\u6dfb\u52a0\u9879\u76ee\u540d\u79f0\u4f5c\u4e3a\u524d\u7f00\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\"># \u4f7f\u7528\u524d\u7f00\u907f\u514d\u51b2\u7a81<\/p>\n<p>MY_PROJECT_DATABASE_URL=postgres:\/\/user:password@localhost\/dbname<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3. \u4fdd\u6301\u73af\u5883\u53d8\u91cf\u5b89\u5168<\/h4>\n<\/p>\n<p><p>\u4e0d\u8981\u5c06\u654f\u611f\u4fe1\u606f\uff08\u5982API\u5bc6\u94a5\u3001\u5bc6\u7801\u7b49\uff09\u76f4\u63a5\u5b58\u50a8\u5728\u4ee3\u7801\u5e93\u4e2d\u3002\u53ef\u4ee5\u4f7f\u7528\u73af\u5883\u53d8\u91cf\u6765\u5b58\u50a8\u654f\u611f\u4fe1\u606f\uff0c\u5e76\u786e\u4fdd\u914d\u7f6e\u6587\u4ef6\u4e0d\u88ab\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u8ffd\u8e2a\u3002<\/p>\n<\/p>\n<p><h4>4. \u6587\u6863\u5316\u73af\u5883\u53d8\u91cf<\/h4>\n<\/p>\n<p><p>\u5728\u9879\u76ee\u6587\u6863\u4e2d\u8bb0\u5f55\u6240\u9700\u7684\u73af\u5883\u53d8\u91cf\u53ca\u5176\u7528\u9014\uff0c\u4fbf\u4e8e\u56e2\u961f\u6210\u5458\u4e86\u89e3\u548c\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u3002<\/p>\n<\/p>\n<p><h3>\u4e03\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u662fPython\u5f00\u53d1\u4e2d\u7684\u91cd\u8981\u4e00\u73af\uff0c\u53ef\u4ee5\u901a\u8fc7\u64cd\u4f5c\u7cfb\u7edf\u63d0\u4f9b\u7684\u5de5\u5177\u3001Python\u811a\u672c\u3001\u865a\u62df\u73af\u5883\u5de5\u5177\u548cIDE\u6765\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u3002\u5728\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u65f6\uff0c\u9700\u8981\u6ce8\u610f\u8def\u5f84\u548c\u8bed\u6cd5\u7684\u6b63\u786e\u6027\uff0c\u786e\u4fdd\u914d\u7f6e\u751f\u6548\u3002\u901a\u8fc7\u9075\u5faa\u6700\u4f73\u5b9e\u8df5\uff0c\u53ef\u4ee5\u66f4\u597d\u5730\u7ba1\u7406\u548c\u4f7f\u7528\u73af\u5883\u53d8\u91cf\uff0c\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Windows\u7cfb\u7edf\u4e2d\u8bbe\u7f6ePython\u7684\u73af\u5883\u53d8\u91cf\uff1f<\/strong><br \/>\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u8bbe\u7f6ePython\u7684\u73af\u5883\u53d8\u91cf\u901a\u5e38\u6d89\u53ca\u5230\u6dfb\u52a0Python\u7684\u5b89\u88c5\u76ee\u5f55\u5230\u7cfb\u7edf\u7684\u201cPATH\u201d\u53d8\u91cf\u4e2d\u3002\u5177\u4f53\u6b65\u9aa4\u4e3a\uff1a\u53f3\u952e\u70b9\u51fb\u201c\u6b64\u7535\u8111\u201d\u6216\u201c\u6211\u7684\u7535\u8111\u201d\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d\uff0c\u7136\u540e\u8fdb\u5165\u201c\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e\u201d\u3002\u5728\u201c\u7cfb\u7edf\u5c5e\u6027\u201d\u7a97\u53e3\u4e2d\uff0c\u70b9\u51fb\u201c\u73af\u5883\u53d8\u91cf\u201d\uff0c\u5728\u201c\u7cfb\u7edf\u53d8\u91cf\u201d\u90e8\u5206\u627e\u5230\u201cPath\u201d\uff0c\u9009\u62e9\u7f16\u8f91\u3002\u70b9\u51fb\u201c\u65b0\u5efa\u201d\uff0c\u6dfb\u52a0Python\u7684\u5b89\u88c5\u8def\u5f84\uff08\u4f8b\u5982\uff1aC:\\Python39\uff09\uff0c\u5e76\u786e\u4fdd\u6dfb\u52a0Python\u7684Scripts\u76ee\u5f55\uff08\u5982C:\\Python39\\Scripts\uff09\u3002\u5b8c\u6210\u540e\uff0c\u70b9\u51fb\u201c\u786e\u5b9a\u201d\u4fdd\u5b58\u66f4\u6539\u3002<\/p>\n<p><strong>\u5728Linux\u6216Mac\u7cfb\u7edf\u4e2d\u5982\u4f55\u914d\u7f6ePython\u73af\u5883\u53d8\u91cf\uff1f<\/strong><br \/>\u5728Linux\u6216Mac\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u7f16\u8f91shell\u914d\u7f6e\u6587\u4ef6\u6765\u8bbe\u7f6ePython\u7684\u73af\u5883\u53d8\u91cf\u3002\u5bf9\u4e8e\u4f7f\u7528bash\u7684\u7528\u6237\uff0c\u53ef\u4ee5\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165<code>nano ~\/.bashrc<\/code>\u6216<code>nano ~\/.bash_profile<\/code>\u3002\u5728\u6587\u4ef6\u672b\u5c3e\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a<code>export PATH=&quot;$PATH:\/usr\/local\/bin\/python3&quot;<\/code>\uff08\u5c06\u8def\u5f84\u66ff\u6362\u4e3a\u5b9e\u9645\u7684Python\u5b89\u88c5\u8def\u5f84\uff09\u3002\u4fdd\u5b58\u5e76\u9000\u51fa\u540e\uff0c\u8fd0\u884c<code>source ~\/.bashrc<\/code>\u6216<code>source ~\/.bash_profile<\/code>\u4ee5\u5e94\u7528\u66f4\u6539\u3002\u8fd9\u5c06\u4f7fPython\u53ef\u5728\u7ec8\u7aef\u4e2d\u76f4\u63a5\u8c03\u7528\u3002<\/p>\n<p><strong>\u5982\u4f55\u9a8c\u8bc1Python\u73af\u5883\u53d8\u91cf\u662f\u5426\u914d\u7f6e\u6210\u529f\uff1f<\/strong><br \/>\u8981\u9a8c\u8bc1Python\u7684\u73af\u5883\u53d8\u91cf\u662f\u5426\u914d\u7f6e\u6210\u529f\uff0c\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u7ec8\u7aef\u4e2d\u8f93\u5165<code>python --version<\/code>\u6216<code>python3 --version<\/code>\u3002\u5982\u679c\u914d\u7f6e\u6b63\u786e\uff0c\u7cfb\u7edf\u5c06\u663e\u793a\u5df2\u5b89\u88c5\u7684Python\u7248\u672c\u53f7\u3002\u5982\u679c\u51fa\u73b0\u201c\u547d\u4ee4\u672a\u627e\u5230\u201d\u6216\u7c7b\u4f3c\u9519\u8bef\uff0c\u8bf4\u660e\u73af\u5883\u53d8\u91cf\u5c1a\u672a\u6b63\u786e\u8bbe\u7f6e\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u91cd\u65b0\u68c0\u67e5\u914d\u7f6e\u6b65\u9aa4\u6216\u786e\u4fddPython\u5df2\u6b63\u786e\u5b89\u88c5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u914d\u7f6e\u73af\u5883\u53d8\u91cfPython\u7684\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528\u64cd\u4f5c\u7cfb\u7edf\u63d0\u4f9b\u7684\u5de5\u5177\u3001\u901a\u8fc7Python\u811a\u672c\u8bbe\u7f6e\u3001\u4f7f\u7528\u865a\u62df\u73af\u5883\u5de5\u5177\u3001\u901a\u8fc7I [&hellip;]","protected":false},"author":3,"featured_media":1178073,"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\/1178069"}],"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=1178069"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1178069\/revisions"}],"predecessor-version":[{"id":1178075,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1178069\/revisions\/1178075"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1178073"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1178069"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1178069"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1178069"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}