{"id":1132189,"date":"2025-01-08T20:54:59","date_gmt":"2025-01-08T12:54:59","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1132189.html"},"modified":"2025-01-08T20:55:02","modified_gmt":"2025-01-08T12:55:02","slug":"%e5%a6%82%e4%bd%95%e6%8a%8a-python-%e6%b7%bb%e5%8a%a0%e5%88%b0%e7%8e%af%e5%a2%83%e5%8f%98%e9%87%8f%e4%b8%ad","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1132189.html","title":{"rendered":"\u5982\u4f55\u628a python \u6dfb\u52a0\u5230\u73af\u5883\u53d8\u91cf\u4e2d"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25101806\/fa42334d-7836-465d-b991-2aa3bcca19c8.webp\" alt=\"\u5982\u4f55\u628a python \u6dfb\u52a0\u5230\u73af\u5883\u53d8\u91cf\u4e2d\" \/><\/p>\n<p><p> <strong>\u6dfb\u52a0 Python \u5230\u73af\u5883\u53d8\u91cf\u7684\u6b65\u9aa4\u5305\u62ec\uff1a\u786e\u5b9a Python \u5b89\u88c5\u8def\u5f84\u3001\u4fee\u6539\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u3001\u9a8c\u8bc1\u914d\u7f6e\u3002\u8fd9\u5c06\u786e\u4fdd\u5728\u547d\u4ee4\u884c\u4e2d\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528 Python\u3002\u4ee5\u4e0b\u662f\u8be6\u7ec6\u6b65\u9aa4\uff1a<\/strong><\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u786e\u5b9a Python \u5b89\u88c5\u8def\u5f84<\/strong>\uff1a\u9996\u5148\uff0c\u627e\u5230 Python \u7684\u5b89\u88c5\u8def\u5f84\u3002\u901a\u5e38\u5728 Windows \u7cfb\u7edf\u4e2d\uff0cPython \u4f1a\u5b89\u88c5\u5728 <code>C:\\PythonXX<\/code> \u6216 <code>C:\\Users\\&lt;YourUsername&gt;\\AppData\\Local\\Programs\\Python\\PythonXX<\/code>\u3002\u5728 macOS \u548c Linux \u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528 <code>which python<\/code> \u6216 <code>which python3<\/code> \u547d\u4ee4\u6765\u67e5\u627e\u8def\u5f84\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4fee\u6539\u7cfb\u7edf\u73af\u5883\u53d8\u91cf<\/strong>\uff1a\u5728 Windows \u7cfb\u7edf\u4e2d\uff0c\u901a\u8fc7\u63a7\u5236\u9762\u677f\u6216\u8005\u7cfb\u7edf\u8bbe\u7f6e\u4fee\u6539\u73af\u5883\u53d8\u91cf\u3002\u5728 macOS \u548c Linux \u7cfb\u7edf\u4e2d\uff0c\u901a\u8fc7\u7f16\u8f91 <code>.bashrc<\/code> \u6216 <code>.zshrc<\/code> \u6587\u4ef6\u6dfb\u52a0 Python \u8def\u5f84\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u9a8c\u8bc1\u914d\u7f6e<\/strong>\uff1a\u786e\u4fdd\u73af\u5883\u53d8\u91cf\u914d\u7f6e\u6210\u529f\uff0c\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165 <code>python --version<\/code> \u6216 <code>python3 --version<\/code> \u6765\u68c0\u67e5 Python \u7248\u672c\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u4e00\u3001\u786e\u5b9a Python \u5b89\u88c5\u8def\u5f84<\/h3>\n<\/p>\n<p><h4>Windows \u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728 Windows \u7cfb\u7edf\u4e2d\uff0c\u627e\u5230 Python \u7684\u5b89\u88c5\u8def\u5f84\u975e\u5e38\u7b80\u5355\u3002\u5982\u679c\u4f60\u662f\u901a\u8fc7\u5b98\u65b9\u5b89\u88c5\u5305\u5b89\u88c5\u7684 Python\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5b83\u4f1a\u5b89\u88c5\u5728\u4ee5\u4e0b\u8def\u5f84\u4e4b\u4e00\uff1a<\/p>\n<\/p>\n<ul>\n<li><code>C:\\PythonXX<\/code> \uff08XX \u8868\u793a\u7248\u672c\u53f7\uff09<\/li>\n<li><code>C:\\Users\\&lt;YourUsername&gt;\\AppData\\Local\\Programs\\Python\\PythonXX<\/code><\/li>\n<\/ul>\n<p><p>\u4f60\u4e5f\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u6765\u786e\u5b9a\u8def\u5f84\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u201c\u5f00\u59cb\u201d\u83dc\u5355\uff0c\u641c\u7d22\u201cPython\u201d\u3002<\/li>\n<li>\u53f3\u952e\u70b9\u51fb Python \u7a0b\u5e8f\uff0c\u9009\u62e9\u201c\u6253\u5f00\u6587\u4ef6\u6240\u5728\u7684\u4f4d\u7f6e\u201d\u3002<\/li>\n<li>\u5728\u6253\u5f00\u7684\u6587\u4ef6\u5939\u4e2d\uff0c\u4f60\u53ef\u4ee5\u770b\u5230 Python \u7684\u5b89\u88c5\u76ee\u5f55\u3002<\/li>\n<\/ol>\n<p><h4>macOS \u548c Linux \u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728 macOS \u548c Linux \u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u7ec8\u7aef\u4f7f\u7528 <code>which<\/code> \u547d\u4ee4\u6765\u67e5\u627e Python \u7684\u5b89\u88c5\u8def\u5f84\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">which python<\/p>\n<p>which python3<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6761\u547d\u4ee4\u4f1a\u8fd4\u56de Python \u53ef\u6267\u884c\u6587\u4ef6\u6240\u5728\u7684\u8def\u5f84\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">\/usr\/local\/bin\/python3<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e8c\u3001\u4fee\u6539\u7cfb\u7edf\u73af\u5883\u53d8\u91cf<\/h3>\n<\/p>\n<p><h4>Windows \u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728 Windows \u7cfb\u7edf\u4e2d\uff0c\u6dfb\u52a0 Python \u5230\u73af\u5883\u53d8\u91cf\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u5b8c\u6210\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u201c\u5f00\u59cb\u201d\u83dc\u5355\uff0c\u641c\u7d22\u201c\u73af\u5883\u53d8\u91cf\u201d\uff0c\u7136\u540e\u9009\u62e9\u201c\u7f16\u8f91\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u201d\u3002<\/li>\n<li>\u5728\u201c\u7cfb\u7edf\u5c5e\u6027\u201d\u5bf9\u8bdd\u6846\u4e2d\uff0c\u70b9\u51fb\u201c\u73af\u5883\u53d8\u91cf\u201d\u6309\u94ae\u3002<\/li>\n<li>\u5728\u201c\u73af\u5883\u53d8\u91cf\u201d\u5bf9\u8bdd\u6846\u4e2d\uff0c\u627e\u5230\u201c\u7cfb\u7edf\u53d8\u91cf\u201d\u90e8\u5206\u7684\u201cPath\u201d\u53d8\u91cf\uff0c\u9009\u62e9\u5b83\u5e76\u70b9\u51fb\u201c\u7f16\u8f91\u201d\u3002<\/li>\n<li>\u5728\u201c\u7f16\u8f91\u73af\u5883\u53d8\u91cf\u201d\u5bf9\u8bdd\u6846\u4e2d\uff0c\u70b9\u51fb\u201c\u65b0\u5efa\u201d\uff0c\u7136\u540e\u8f93\u5165 Python \u7684\u5b89\u88c5\u8def\u5f84\u3002\u4f8b\u5982\uff1a<code>C:\\Users\\&lt;YourUsername&gt;\\AppData\\Local\\Programs\\Python\\PythonXX<\/code>\u3002<\/li>\n<li>\u70b9\u51fb\u201c\u786e\u5b9a\u201d\u4fdd\u5b58\u8bbe\u7f6e\u3002<\/li>\n<\/ol>\n<p><h4>macOS \u548c Linux \u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728 macOS \u548c Linux \u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u7f16\u8f91\u7ec8\u7aef\u914d\u7f6e\u6587\u4ef6\u6765\u6dfb\u52a0 Python \u5230\u73af\u5883\u53d8\u91cf\u3002\u5e38\u89c1\u7684\u914d\u7f6e\u6587\u4ef6\u5305\u62ec <code>.bashrc<\/code>\u3001<code>.bash_profile<\/code> \u548c <code>.zshrc<\/code>\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p>\u6253\u5f00\u7ec8\u7aef\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p>\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00\u914d\u7f6e\u6587\u4ef6\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">nano ~\/.bashrc<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p>\u5728\u6587\u4ef6\u672b\u5c3e\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">export PATH=&quot;\/usr\/local\/bin\/python3:$PATH&quot;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p>\u4fdd\u5b58\u6587\u4ef6\u5e76\u9000\u51fa\u7f16\u8f91\u5668\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p>\u4f7f\u66f4\u6539\u751f\u6548\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">source ~\/.bashrc<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u4e09\u3001\u9a8c\u8bc1\u914d\u7f6e<\/h3>\n<\/p>\n<p><p>\u914d\u7f6e\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u6765\u9a8c\u8bc1 Python \u662f\u5426\u5df2\u6210\u529f\u6dfb\u52a0\u5230\u73af\u5883\u53d8\u91cf\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p>\u6253\u5f00\u547d\u4ee4\u884c\u7a97\u53e3\uff08Windows \u7cfb\u7edf\u4e2d\u6253\u5f00 CMD \u6216 PowerShell\uff0cmacOS \u548c Linux \u7cfb\u7edf\u4e2d\u6253\u5f00\u7ec8\u7aef\uff09\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p>\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u68c0\u67e5 Python \u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python --version<\/p>\n<p>\u6216<\/p>\n<p>python3 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u5982\u679c\u8fd4\u56de\u4e86\u6b63\u786e\u7684 Python \u7248\u672c\u53f7\uff0c\u8bf4\u660e\u914d\u7f6e\u6210\u529f\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u5e38\u89c1\u95ee\u9898\u53ca\u89e3\u51b3\u65b9\u6cd5<\/h3>\n<\/p>\n<p><h4>1. Python \u547d\u4ee4\u65e0\u6548<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165 <code>python<\/code> \u6216 <code>python3<\/code> \u540e\u63d0\u793a\u201c\u547d\u4ee4\u65e0\u6548\u201d\u6216\u7c7b\u4f3c\u9519\u8bef\uff0c\u53ef\u80fd\u662f\u8def\u5f84\u914d\u7f6e\u6709\u8bef\u3002\u8bf7\u68c0\u67e5\u73af\u5883\u53d8\u91cf\u4e2d\u7684\u8def\u5f84\u662f\u5426\u6b63\u786e\uff0c\u5e76\u786e\u4fdd\u8def\u5f84\u4e2d\u5305\u542b Python \u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h4>2. \u591a\u4e2a Python \u7248\u672c\u5171\u5b58<\/h4>\n<\/p>\n<p><p>\u5728\u540c\u4e00\u7cfb\u7edf\u4e2d\u5b89\u88c5\u591a\u4e2a Python \u7248\u672c\u65f6\uff0c\u53ef\u80fd\u4f1a\u51fa\u73b0\u7248\u672c\u51b2\u7a81\u7684\u95ee\u9898\u3002\u53ef\u4ee5\u901a\u8fc7\u6307\u5b9a\u5b8c\u6574\u8def\u5f84\u6765\u4f7f\u7528\u7279\u5b9a\u7248\u672c\u7684 Python\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">\/usr\/local\/bin\/python3.8<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3. \u6743\u9650\u95ee\u9898<\/h4>\n<\/p>\n<p><p>\u5728\u4fee\u6539\u73af\u5883\u53d8\u91cf\u6216\u7f16\u8f91\u914d\u7f6e\u6587\u4ef6\u65f6\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u6743\u9650\u95ee\u9898\u3002\u786e\u4fdd\u4f60\u6709\u8db3\u591f\u7684\u6743\u9650\u6765\u4fee\u6539\u8fd9\u4e9b\u6587\u4ef6\u3002\u5728 macOS \u548c Linux \u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528 <code>sudo<\/code> \u547d\u4ee4\u6765\u63d0\u5347\u6743\u9650\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo nano \/etc\/profile<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e94\u3001Python \u73af\u5883\u53d8\u91cf\u7684\u9ad8\u7ea7\u914d\u7f6e<\/h3>\n<\/p>\n<p><h4>1. \u4f7f\u7528\u865a\u62df\u73af\u5883<\/h4>\n<\/p>\n<p><p>\u5728\u5f00\u53d1 Python \u9879\u76ee\u65f6\uff0c\u5efa\u8bae\u4f7f\u7528\u865a\u62df\u73af\u5883\u6765\u9694\u79bb\u4f9d\u8d56\u3002\u53ef\u4ee5\u4f7f\u7528 <code>venv<\/code> \u6a21\u5757\u6765\u521b\u5efa\u865a\u62df\u73af\u5883\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python3 -m venv myenv<\/p>\n<p>source myenv\/bin\/activate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u540e\uff0cPython \u53ef\u6267\u884c\u6587\u4ef6\u548c\u4f9d\u8d56\u5c06\u88ab\u9694\u79bb\u5728\u865a\u62df\u73af\u5883\u4e2d\uff0c\u907f\u514d\u4e0e\u5168\u5c40\u73af\u5883\u51b2\u7a81\u3002<\/p>\n<\/p>\n<p><h4>2. \u4f7f\u7528\u73af\u5883\u7ba1\u7406\u5de5\u5177<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528\u4e00\u4e9b\u73af\u5883\u7ba1\u7406\u5de5\u5177\u6765\u7b80\u5316 Python \u7248\u672c\u548c\u73af\u5883\u7684\u7ba1\u7406\u3002\u4f8b\u5982 <code>pyenv<\/code> \u53ef\u4ee5\u8f7b\u677e\u5730\u5728\u591a\u4e2a Python \u7248\u672c\u4e4b\u95f4\u5207\u6362\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pyenv install 3.8.6<\/p>\n<p>pyenv global 3.8.6<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4f7f\u7528 <code>pyenv<\/code> \u53ef\u4ee5\u907f\u514d\u624b\u52a8\u4fee\u6539\u73af\u5883\u53d8\u91cf\uff0c\u5e76\u4e14\u652f\u6301\u591a\u7248\u672c\u5171\u5b58\u548c\u5feb\u901f\u5207\u6362\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u5c06 Python \u6dfb\u52a0\u5230\u73af\u5883\u53d8\u91cf\u4e2d\u662f\u4f7f\u7528 Python \u5f00\u53d1\u548c\u8fd0\u884c\u811a\u672c\u7684\u57fa\u7840\u6b65\u9aa4\u3002\u901a\u8fc7\u786e\u5b9a Python \u5b89\u88c5\u8def\u5f84\u3001\u4fee\u6539\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u3001\u9a8c\u8bc1\u914d\u7f6e\uff0c\u53ef\u4ee5\u786e\u4fdd\u5728\u547d\u4ee4\u884c\u4e2d\u65b9\u4fbf\u5730\u4f7f\u7528 Python\u3002\u9047\u5230\u95ee\u9898\u65f6\uff0c\u53ef\u4ee5\u6839\u636e\u63d0\u793a\u4fe1\u606f\u8fdb\u884c\u6392\u67e5\u548c\u4fee\u6b63\u3002\u6b64\u5916\uff0c\u4f7f\u7528\u865a\u62df\u73af\u5883\u548c\u73af\u5883\u7ba1\u7406\u5de5\u5177\u53ef\u4ee5\u8fdb\u4e00\u6b65\u63d0\u5347\u5f00\u53d1\u6548\u7387\u548c\u73af\u5883\u7ba1\u7406\u7684\u7075\u6d3b\u6027\u3002<\/p>\n<\/p>\n<p><p>\u65e0\u8bba\u662f\u5728 Windows\u3001macOS \u8fd8\u662f Linux \u7cfb\u7edf\u4e2d\uff0c\u6dfb\u52a0 Python \u5230\u73af\u5883\u53d8\u91cf\u7684\u6b65\u9aa4\u90fd\u5927\u540c\u5c0f\u5f02\uff0c\u5173\u952e\u5728\u4e8e\u8def\u5f84\u7684\u786e\u5b9a\u548c\u73af\u5883\u53d8\u91cf\u7684\u6b63\u786e\u914d\u7f6e\u3002\u5e0c\u671b\u672c\u6587\u80fd\u591f\u5e2e\u52a9\u4f60\u987a\u5229\u914d\u7f6e Python \u73af\u5883\uff0c\u5e76\u5728 Python \u5f00\u53d1\u4e2d\u83b7\u5f97\u66f4\u597d\u7684\u4f53\u9a8c\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u9a8c\u8bc1 Python \u662f\u5426\u6210\u529f\u6dfb\u52a0\u5230\u73af\u5883\u53d8\u91cf\u4e2d\uff1f<\/strong><br \/>\u8981\u786e\u8ba4 Python \u662f\u5426\u5df2\u7ecf\u6210\u529f\u6dfb\u52a0\u5230\u73af\u5883\u53d8\u91cf\uff0c\u53ef\u4ee5\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u6216\u7ec8\u7aef\u4e2d\u8f93\u5165 <code>python --version<\/code> \u6216 <code>python3 --version<\/code>\u3002\u5982\u679c\u663e\u793a\u51fa Python \u7684\u7248\u672c\u53f7\uff0c\u8bf4\u660e\u6dfb\u52a0\u6210\u529f\u3002\u5982\u679c\u51fa\u73b0\u201c\u547d\u4ee4\u672a\u627e\u5230\u201d\u7684\u63d0\u793a\uff0c\u5219\u9700\u8981\u91cd\u65b0\u68c0\u67e5\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u3002<\/p>\n<p><strong>\u5728 Windows \u548c macOS \u4e0a\u6dfb\u52a0 Python \u5230\u73af\u5883\u53d8\u91cf\u7684\u6b65\u9aa4\u6709\u54ea\u4e9b\uff1f<\/strong><br \/>\u5728 Windows \u4e0a\uff0c\u53ef\u4ee5\u901a\u8fc7\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\u70b9\u51fb\u201c\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e\u201d\uff0c\u5728\u201c\u7cfb\u7edf\u5c5e\u6027\u201d\u5bf9\u8bdd\u6846\u4e2d\u627e\u5230\u201c\u73af\u5883\u53d8\u91cf\u201d\u6309\u94ae\u3002\u5728\u201c\u7cfb\u7edf\u53d8\u91cf\u201d\u4e2d\u627e\u5230\u201cPath\u201d\uff0c\u7136\u540e\u6dfb\u52a0 Python \u7684\u5b89\u88c5\u8def\u5f84\u3002\u5728 macOS \u4e0a\uff0c\u53ef\u4ee5\u6253\u5f00\u7ec8\u7aef\uff0c\u4f7f\u7528\u547d\u4ee4 <code>nano ~\/.bash_profile<\/code> \u6216 <code>nano ~\/.zshrc<\/code> \u6765\u7f16\u8f91\u914d\u7f6e\u6587\u4ef6\uff0c\u6dfb\u52a0 <code>export PATH=&quot;\/usr\/local\/bin\/python:$PATH&quot;<\/code>\uff0c\u4fdd\u5b58\u540e\u4f7f\u7528 <code>source ~\/.bash_profile<\/code> \u6216 <code>source ~\/.zshrc<\/code> \u4f7f\u6539\u52a8\u751f\u6548\u3002<\/p>\n<p><strong>\u5982\u679c\u6211\u5728\u5b89\u88c5 Python \u65f6\u6ca1\u6709\u9009\u62e9\u5c06\u5176\u6dfb\u52a0\u5230\u73af\u5883\u53d8\u91cf\uff0c\u5982\u4f55\u540e\u7eed\u64cd\u4f5c\uff1f<\/strong><br \/>\u5982\u679c\u5728\u5b89\u88c5 Python \u65f6\u6ca1\u6709\u9009\u62e9\u5c06\u5176\u81ea\u52a8\u6dfb\u52a0\u5230\u73af\u5883\u53d8\u91cf\uff0c\u53ef\u4ee5\u624b\u52a8\u8fdb\u884c\u8bbe\u7f6e\u3002\u627e\u5230 Python \u7684\u5b89\u88c5\u8def\u5f84\uff0c\u901a\u5e38\u5728 <code>C:\\PythonXX<\/code>\uff08XX\u4ee3\u8868\u7248\u672c\u53f7\uff09\u6216 <code>\/usr\/local\/bin\/python<\/code>\u3002\u63a5\u4e0b\u6765\uff0c\u6309\u7167\u64cd\u4f5c\u7cfb\u7edf\u7684\u4e0d\u540c\uff0c\u8bbf\u95ee\u7cfb\u7edf\u7684\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u754c\u9762\uff0c\u624b\u52a8\u5c06\u8be5\u8def\u5f84\u6dfb\u52a0\u5230\u7cfb\u7edf\u7684 Path \u53d8\u91cf\u4e2d\u3002\u5b8c\u6210\u540e\uff0c\u91cd\u542f\u7ec8\u7aef\u6216\u547d\u4ee4\u63d0\u793a\u7b26\u4ee5\u4f7f\u8bbe\u7f6e\u751f\u6548\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u6dfb\u52a0 Python \u5230\u73af\u5883\u53d8\u91cf\u7684\u6b65\u9aa4\u5305\u62ec\uff1a\u786e\u5b9a Python \u5b89\u88c5\u8def\u5f84\u3001\u4fee\u6539\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u3001\u9a8c\u8bc1\u914d\u7f6e\u3002\u8fd9\u5c06\u786e\u4fdd\u5728 [&hellip;]","protected":false},"author":3,"featured_media":1132197,"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\/1132189"}],"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=1132189"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1132189\/revisions"}],"predecessor-version":[{"id":1132200,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1132189\/revisions\/1132200"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1132197"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1132189"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1132189"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1132189"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}