{"id":1152006,"date":"2025-01-13T17:20:20","date_gmt":"2025-01-13T09:20:20","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1152006.html"},"modified":"2025-01-13T17:20:22","modified_gmt":"2025-01-13T09:20:22","slug":"%e5%a6%82%e4%bd%95%e6%9b%b4%e6%96%b0python%e7%9a%84%e7%89%88%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1152006.html","title":{"rendered":"\u5982\u4f55\u66f4\u65b0python\u7684\u7248\u672c"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25182108\/2571645d-7468-4b14-93e6-b556ece4c40e.webp\" alt=\"\u5982\u4f55\u66f4\u65b0python\u7684\u7248\u672c\" \/><\/p>\n<p><p> <strong>\u5982\u4f55\u66f4\u65b0Python\u7684\u7248\u672c\uff1a\u4f7f\u7528\u5305\u7ba1\u7406\u5de5\u5177\u3001\u4e0b\u8f7d\u6700\u65b0\u5b89\u88c5\u5305\u3001\u4f7f\u7528\u7248\u672c\u7ba1\u7406\u5de5\u5177<\/strong><\/p>\n<\/p>\n<p><p>\u66f4\u65b0Python\u7248\u672c\u7684\u4e3b\u8981\u65b9\u6cd5\u6709\uff1a<strong>\u4f7f\u7528\u5305\u7ba1\u7406\u5de5\u5177\u3001\u4e0b\u8f7d\u6700\u65b0\u5b89\u88c5\u5305\u3001\u4f7f\u7528\u7248\u672c\u7ba1\u7406\u5de5\u5177<\/strong>\u3002\u8fd9\u4e9b\u65b9\u6cd5\u5404\u6709\u4f18\u52a3\uff0c\u5177\u4f53\u9009\u62e9\u9700\u8981\u6839\u636e\u4e2a\u4eba\u9700\u6c42\u548c\u64cd\u4f5c\u7cfb\u7edf\u800c\u5b9a\u3002<strong>\u4f7f\u7528\u5305\u7ba1\u7406\u5de5\u5177<\/strong>\u662f\u4e00\u79cd\u5feb\u901f\u4fbf\u6377\u7684\u65b9\u6cd5\uff0c\u9002\u7528\u4e8e\u5927\u90e8\u5206\u64cd\u4f5c\u7cfb\u7edf\uff1b<strong>\u4e0b\u8f7d\u6700\u65b0\u5b89\u88c5\u5305<\/strong>\u5219\u9002\u7528\u4e8e\u9700\u8981\u81ea\u5b9a\u4e49\u5b89\u88c5\u8def\u5f84\u6216\u591a\u7248\u672c\u5171\u5b58\u7684\u573a\u666f\uff1b<strong>\u4f7f\u7528\u7248\u672c\u7ba1\u7406\u5de5\u5177<\/strong>\uff08\u5982pyenv\uff09\u5219\u9002\u5408\u5f00\u53d1\u8005\u5728\u4e0d\u540c\u9879\u76ee\u95f4\u5207\u6362Python\u7248\u672c\u3002<\/p>\n<\/p>\n<p><p><strong>\u4f7f\u7528\u5305\u7ba1\u7406\u5de5\u5177<\/strong>\uff1a\u8fd9\u662f\u66f4\u65b0Python\u7248\u672c\u6700\u7b80\u5355\u7684\u65b9\u5f0f\u4e4b\u4e00\u3002\u4ee5Ubuntu\u7cfb\u7edf\u4e3a\u4f8b\uff0c\u6253\u5f00\u7ec8\u7aef\u5e76\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt-get update<\/p>\n<p>sudo apt-get install python3.9<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6837\u5c31\u80fd\u5728\u7cfb\u7edf\u4e2d\u5b89\u88c5Python 3.9\u7248\u672c\u4e86\u3002\u5bf9\u4e8eWindows\u548cmacOS\u7528\u6237\uff0c\u53ef\u4ee5\u4f7f\u7528\u7c7b\u4f3c\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u6bd4\u5982Homebrew\uff08macOS\uff09\u6216choco\uff08Windows\uff09\u3002\u8fd9\u4e9b\u5de5\u5177\u80fd\u591f\u81ea\u52a8\u5904\u7406\u4f9d\u8d56\u5173\u7cfb\uff0c\u4f7f\u5b89\u88c5\u8fc7\u7a0b\u66f4\u52a0\u987a\u7545\u3002<\/p>\n<\/p>\n<hr>\n<p><h3>\u4e00\u3001\u4f7f\u7528\u5305\u7ba1\u7406\u5de5\u5177<\/h3>\n<\/p>\n<p><p>\u5305\u7ba1\u7406\u5de5\u5177\u662f\u7cfb\u7edf\u4e2d\u7528\u4e8e\u5b89\u88c5\u3001\u66f4\u65b0\u548c\u7ba1\u7406\u8f6f\u4ef6\u5305\u7684\u5de5\u5177\u3002\u4e0d\u540c\u64cd\u4f5c\u7cfb\u7edf\u6709\u4e0d\u540c\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u4f8b\u5982Ubuntu\u7cfb\u7edf\u4e2d\u7684apt-get\u3001Red Hat\u7cfb\u7cfb\u7edf\u4e2d\u7684yum\u548cdnf\u3001macOS\u4e2d\u7684Homebrew\u4ee5\u53caWindows\u4e2d\u7684Chocolatey\u3002\u8fd9\u4e9b\u5de5\u5177\u80fd\u591f\u5e2e\u52a9\u7528\u6237\u5feb\u901f\u4e0b\u8f7d\u5e76\u5b89\u88c5\u6240\u9700\u7684\u8f6f\u4ef6\u5305\uff0c\u540c\u65f6\u5904\u7406\u4f9d\u8d56\u5173\u7cfb\u3002<\/p>\n<\/p>\n<p><h4>1.1 Ubuntu\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728Ubuntu\u7cfb\u7edf\u4e2d\uff0capt-get\u662f\u6700\u5e38\u7528\u7684\u5305\u7ba1\u7406\u5de5\u5177\u3002\u8981\u66f4\u65b0Python\u7248\u672c\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5b8c\u6210\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt-get update<\/p>\n<p>sudo apt-get install python3.x<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5176\u4e2d\uff0c<code>python3.x<\/code>\u4ee3\u8868\u4f60\u60f3\u8981\u5b89\u88c5\u7684Python\u7248\u672c\u3002\u4f8b\u5982\uff0c\u8981\u5b89\u88c5Python 3.9\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt-get install python3.9<\/p>\n<p><\/code><\/pre>\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-bash\">python3.9 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6837\u5c31\u80fd\u591f\u770b\u5230\u5df2\u7ecf\u5b89\u88c5\u7684Python\u7248\u672c\u53f7\u3002<\/p>\n<\/p>\n<p><h4>1.2 Red Hat\u7cfb\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5bf9\u4e8eRed Hat\u7cfb\u7684\u7cfb\u7edf\uff08\u5982CentOS\u3001Fedora\uff09\uff0c\u53ef\u4ee5\u4f7f\u7528yum\u6216dnf\u5305\u7ba1\u7406\u5de5\u5177\u3002\u4ee5\u4e0b\u662f\u4f7f\u7528yum\u5b89\u88c5Python 3.9\u7684\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo yum install -y python39<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6216\u8005\u4f7f\u7528dnf\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo dnf install -y python39<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u540c\u6837\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-bash\">python3.9 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>1.3 macOS\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728macOS\u7cfb\u7edf\u4e2d\uff0cHomebrew\u662f\u4e00\u4e2a\u975e\u5e38\u6d41\u884c\u7684\u5305\u7ba1\u7406\u5de5\u5177\u3002\u9996\u5148\uff0c\u9700\u8981\u786e\u4fdd\u5df2\u7ecf\u5b89\u88c5\u4e86Homebrew\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5Homebrew\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">\/bin\/bash -c &quot;$(curl -fsSL https:\/\/raw.githubusercontent.com\/Homebrew\/install\/HEAD\/install.sh)&quot;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528Homebrew\u5b89\u88c5Python 3.9\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">brew install python@3.9<\/p>\n<p><\/code><\/pre>\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-bash\">python3.9 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>1.4 Windows\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728Windows\u7cfb\u7edf\u4e2d\uff0cChocolatey\u662f\u4e00\u4e2a\u7c7b\u4f3c\u4e8eLinux\u5305\u7ba1\u7406\u5de5\u5177\u7684\u5de5\u5177\u3002\u9996\u5148\uff0c\u9700\u8981\u5b89\u88c5Chocolatey\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5728PowerShell\u4e2d\u5b89\u88c5Chocolatey\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-powershell\">Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString(&#39;https:\/\/community.chocolatey.org\/install.ps1&#39;))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528Chocolatey\u5b89\u88c5Python 3.9\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-powershell\">choco install python --version=3.9.0<\/p>\n<p><\/code><\/pre>\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-powershell\">python --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<hr>\n<p><h3>\u4e8c\u3001\u4e0b\u8f7d\u6700\u65b0\u5b89\u88c5\u5305<\/h3>\n<\/p>\n<p><p>\u4e0b\u8f7d\u6700\u65b0\u7684Python\u5b89\u88c5\u5305\u662f\u4e00\u79cd\u624b\u52a8\u66f4\u65b0Python\u7248\u672c\u7684\u65b9\u6cd5\u3002\u9002\u7528\u4e8e\u9700\u8981\u81ea\u5b9a\u4e49\u5b89\u88c5\u8def\u5f84\u6216\u591a\u7248\u672c\u5171\u5b58\u7684\u573a\u666f\u3002\u7528\u6237\u53ef\u4ee5\u4ecePython\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u6240\u9700\u7248\u672c\u7684\u5b89\u88c5\u5305\uff0c\u5e76\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n<\/p>\n<p><h4>2.1 Python\u5b98\u65b9\u7f51\u7ad9<\/h4>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9\uff1a<a href=\"https:\/\/www.python.org\/%EF%BC%8C%E5%AF%BC%E8%88%AA%E5%88%B0Downloads%E9%A1%B5%E9%9D%A2%E3%80%82%E6%A0%B9%E6%8D%AE%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E9%80%89%E6%8B%A9%E5%90%88%E9%80%82%E7%9A%84%E5%AE%89%E8%A3%85%E5%8C%85%E7%89%88%E6%9C%AC%E3%80%82%E4%B8%8B%E8%BD%BD%E5%AE%8C%E6%88%90%E5%90%8E%EF%BC%8C%E6%8C%89%E7%85%A7%E5%AE%89%E8%A3%85%E5%90%91%E5%AF%BC%E8%BF%9B%E8%A1%8C%E5%AE%89%E8%A3%85%E3%80%82\">https:\/\/www.python.org\/\uff0c\u5bfc\u822a\u5230Downloads\u9875\u9762\u3002\u6839\u636e\u64cd\u4f5c\u7cfb\u7edf\u9009\u62e9\u5408\u9002\u7684\u5b89\u88c5\u5305\u7248\u672c\u3002\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u6309\u7167\u5b89\u88c5\u5411\u5bfc\u8fdb\u884c\u5b89\u88c5\u3002<\/a><\/p>\n<\/p>\n<p><h4>2.2 \u81ea\u5b9a\u4e49\u5b89\u88c5\u8def\u5f84<\/h4>\n<\/p>\n<p><p>\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u7528\u6237\u53ef\u4ee5\u9009\u62e9\u81ea\u5b9a\u4e49\u5b89\u88c5\u8def\u5f84\u3002\u8fd9\u5bf9\u4e8e\u9700\u8981\u5728\u7cfb\u7edf\u4e2d\u5b89\u88c5\u591a\u4e2a\u4e0d\u540c\u7248\u672c\u7684Python\u975e\u5e38\u6709\u7528\u3002\u4f8b\u5982\uff0c\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u5c06Python 3.9\u5b89\u88c5\u5728<code>C:\\Python39<\/code>\u76ee\u5f55\u4e0b\u3002<\/p>\n<\/p>\n<p><h4>2.3 \u66f4\u65b0\u7cfb\u7edf\u53d8\u91cf<\/h4>\n<\/p>\n<p><p>\u5b8c\u6210\u5b89\u88c5\u540e\uff0c\u9700\u8981\u66f4\u65b0\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\uff0c\u4ee5\u786e\u4fdd\u65b0\u7684Python\u7248\u672c\u80fd\u591f\u88ab\u6b63\u786e\u8c03\u7528\u3002\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u66f4\u65b0\u73af\u5883\u53d8\u91cf\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u201c\u63a7\u5236\u9762\u677f\u201d -&gt; \u201c\u7cfb\u7edf\u548c\u5b89\u5168\u201d -&gt; \u201c\u7cfb\u7edf\u201d -&gt; \u201c\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e\u201d\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\u5217\u8868\u4e2d\uff0c\u627e\u5230\u5e76\u7f16\u8f91\u201cPath\u201d\u53d8\u91cf\u3002<\/li>\n<li>\u5c06\u65b0\u7684Python\u5b89\u88c5\u8def\u5f84\uff08\u5982<code>C:\\Python39<\/code>\uff09\u6dfb\u52a0\u5230\u53d8\u91cf\u503c\u4e2d\u3002<\/li>\n<\/ol>\n<p><p>\u5728macOS\u548cLinux\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539<code>~\/.bashrc<\/code>\u6216<code>~\/.zshrc<\/code>\u6587\u4ef6\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">export PATH=&quot;\/path\/to\/python3.9:$PATH&quot;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4fdd\u5b58\u5e76\u91cd\u65b0\u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">source ~\/.bashrc<\/p>\n<p><\/code><\/pre>\n<\/p>\n<hr>\n<p><h3>\u4e09\u3001\u4f7f\u7528\u7248\u672c\u7ba1\u7406\u5de5\u5177<\/h3>\n<\/p>\n<p><p>Python\u7248\u672c\u7ba1\u7406\u5de5\u5177\uff08\u5982pyenv\uff09\u80fd\u591f\u5e2e\u52a9\u7528\u6237\u5728\u4e0d\u540c\u9879\u76ee\u95f4\u8f7b\u677e\u5207\u6362Python\u7248\u672c\uff0c\u975e\u5e38\u9002\u5408\u5f00\u53d1\u8005\u4f7f\u7528\u3002\u8fd9\u4e9b\u5de5\u5177\u901a\u5e38\u652f\u6301\u591a\u7248\u672c\u5171\u5b58\uff0c\u5e76\u63d0\u4f9b\u7b80\u4fbf\u7684\u7248\u672c\u5207\u6362\u547d\u4ee4\u3002<\/p>\n<\/p>\n<p><h4>3.1 \u5b89\u88c5pyenv<\/h4>\n<\/p>\n<p><p>pyenv\u662f\u4e00\u4e2a\u6d41\u884c\u7684Python\u7248\u672c\u7ba1\u7406\u5de5\u5177\u3002\u4ee5\u4e0b\u662f\u5728\u4e0d\u540c\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u5b89\u88c5pyenv\u7684\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<p><h5>3.1.1 Ubuntu\u7cfb\u7edf<\/h5>\n<\/p>\n<p><p>\u5728Ubuntu\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5pyenv\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">curl https:\/\/pyenv.run | bash<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\u5230<code>~\/.bashrc<\/code>\u6587\u4ef6\u4e2d\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">export PATH=&quot;$HOME\/.pyenv\/bin:$PATH&quot;<\/p>\n<p>eval &quot;$(pyenv init --path)&quot;<\/p>\n<p>eval &quot;$(pyenv init -)&quot;<\/p>\n<p>eval &quot;$(pyenv virtualenv-init -)&quot;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4fdd\u5b58\u5e76\u91cd\u65b0\u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">source ~\/.bashrc<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h5>3.1.2 macOS\u7cfb\u7edf<\/h5>\n<\/p>\n<p><p>\u5728macOS\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7Homebrew\u5b89\u88c5pyenv\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">brew install pyenv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\u5230<code>~\/.zshrc<\/code>\u6587\u4ef6\u4e2d\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">export PATH=&quot;$HOME\/.pyenv\/bin:$PATH&quot;<\/p>\n<p>eval &quot;$(pyenv init --path)&quot;<\/p>\n<p>eval &quot;$(pyenv init -)&quot;<\/p>\n<p>eval &quot;$(pyenv virtualenv-init -)&quot;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4fdd\u5b58\u5e76\u91cd\u65b0\u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">source ~\/.zshrc<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h5>3.1.3 Windows\u7cfb\u7edf<\/h5>\n<\/p>\n<p><p>\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528Git Bash\u6216WSL\uff08Windows Subsystem for Linux\uff09\u6765\u5b89\u88c5pyenv\u3002\u4ee5\u4e0b\u662f\u5728WSL\u4e2d\u5b89\u88c5pyenv\u7684\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">curl https:\/\/pyenv.run | bash<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\u5230<code>~\/.bashrc<\/code>\u6587\u4ef6\u4e2d\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">export PATH=&quot;$HOME\/.pyenv\/bin:$PATH&quot;<\/p>\n<p>eval &quot;$(pyenv init --path)&quot;<\/p>\n<p>eval &quot;$(pyenv init -)&quot;<\/p>\n<p>eval &quot;$(pyenv virtualenv-init -)&quot;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4fdd\u5b58\u5e76\u91cd\u65b0\u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">source ~\/.bashrc<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3.2 \u5b89\u88c5\u548c\u5207\u6362Python\u7248\u672c<\/h4>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528pyenv\u5b89\u88c5\u6240\u9700\u7684Python\u7248\u672c\u3002\u4f8b\u5982\uff0c\u8981\u5b89\u88c5Python 3.9.0\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pyenv install 3.9.0<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5207\u6362\u5230\u65b0\u5b89\u88c5\u7684Python\u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pyenv global 3.9.0<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u9a8c\u8bc1\u5f53\u524d\u4f7f\u7528\u7684Python\u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3.3 \u7ba1\u7406\u591a\u4e2a\u9879\u76ee\u7684Python\u7248\u672c<\/h4>\n<\/p>\n<p><p>pyenv\u8fd8\u652f\u6301\u4e3a\u4e0d\u540c\u9879\u76ee\u8bbe\u7f6e\u4e0d\u540c\u7684Python\u7248\u672c\u3002\u4f8b\u5982\uff0c\u5728\u9879\u76ee\u76ee\u5f55\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8bbe\u7f6e\u7279\u5b9a\u7684Python\u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">cd \/path\/to\/project<\/p>\n<p>pyenv local 3.8.5<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6837\uff0c\u5728\u8be5\u9879\u76ee\u76ee\u5f55\u4e2d\uff0c\u5c06\u4f7f\u7528Python 3.8.5\u7248\u672c\uff0c\u800c\u5728\u5176\u4ed6\u76ee\u5f55\u4e2d\u4ecd\u7136\u4f7f\u7528\u5168\u5c40\u8bbe\u7f6e\u7684Python\u7248\u672c\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u9a8c\u8bc1\u5f53\u524d\u4f7f\u7528\u7684Python\u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<hr>\n<p><h3>\u56db\u3001\u66f4\u65b0pip\u548c\u76f8\u5173\u5e93<\/h3>\n<\/p>\n<p><p>\u5728\u66f4\u65b0Python\u7248\u672c\u540e\uff0c\u5efa\u8bae\u540c\u65f6\u66f4\u65b0pip\u548c\u76f8\u5173\u5e93\uff0c\u4ee5\u786e\u4fdd\u517c\u5bb9\u6027\u548c\u83b7\u5f97\u6700\u65b0\u7684\u529f\u80fd\u548c\u5b89\u5168\u4fee\u590d\u3002<\/p>\n<\/p>\n<p><h4>4.1 \u66f4\u65b0pip<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u66f4\u65b0pip\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python -m pip install --upgrade pip<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>4.2 \u66f4\u65b0\u5df2\u5b89\u88c5\u7684\u5e93<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u66f4\u65b0\u6240\u6709\u5df2\u5b89\u88c5\u7684\u5e93\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip list --outdated<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\uff0c\u9010\u4e2a\u66f4\u65b0\u5217\u51fa\u7684\u5e93\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install --upgrade package_name<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5176\u4e2d\uff0c<code>package_name<\/code>\u662f\u9700\u8981\u66f4\u65b0\u7684\u5e93\u7684\u540d\u79f0\u3002<\/p>\n<\/p>\n<p><h4>4.3 \u4f7f\u7528\u865a\u62df\u73af\u5883<\/h4>\n<\/p>\n<p><p>\u4e3a\u4e86\u907f\u514d\u5e93\u7684\u7248\u672c\u51b2\u7a81\uff0c\u5efa\u8bae\u5728\u6bcf\u4e2a\u9879\u76ee\u4e2d\u4f7f\u7528\u865a\u62df\u73af\u5883\u3002\u53ef\u4ee5\u4f7f\u7528Python\u81ea\u5e26\u7684<code>venv<\/code>\u6a21\u5757\u521b\u5efa\u865a\u62df\u73af\u5883\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python -m venv myenv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\uff0c\u6fc0\u6d3b\u865a\u62df\u73af\u5883\uff1a<\/p>\n<\/p>\n<ul>\n<li>\n<p>\u5728Windows\u7cfb\u7edf\u4e2d\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-powershell\">myenv\\Scripts\\activate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p>\u5728macOS\u548cLinux\u7cfb\u7edf\u4e2d\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">source myenv\/bin\/activate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<p><p>\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u540e\uff0c\u53ef\u4ee5\u5728\u5176\u4e2d\u5b89\u88c5\u6240\u9700\u7684\u5e93\uff0c\u800c\u4e0d\u5f71\u54cd\u7cfb\u7edf\u7ea7\u522b\u7684Python\u73af\u5883\u3002<\/p>\n<\/p>\n<hr>\n<p><h3>\u4e94\u3001\u6d4b\u8bd5\u548c\u9a8c\u8bc1<\/h3>\n<\/p>\n<p><p>\u5728\u66f4\u65b0Python\u7248\u672c\u540e\uff0c\u5efa\u8bae\u8fdb\u884c\u5145\u5206\u7684\u6d4b\u8bd5\u548c\u9a8c\u8bc1\uff0c\u4ee5\u786e\u4fdd\u65b0\u7248\u672c\u4e0d\u4f1a\u5f15\u5165\u517c\u5bb9\u6027\u95ee\u9898\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684\u6d4b\u8bd5\u548c\u9a8c\u8bc1\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<p><h4>5.1 \u8fd0\u884c\u73b0\u6709\u9879\u76ee<\/h4>\n<\/p>\n<p><p>\u5728\u66f4\u65b0Python\u7248\u672c\u540e\uff0c\u9996\u5148\u8fd0\u884c\u73b0\u6709\u9879\u76ee\uff0c\u68c0\u67e5\u662f\u5426\u6709\u4efb\u4f55\u9519\u8bef\u6216\u5f02\u5e38\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u8fd0\u884cPython\u811a\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python script_name.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5176\u4e2d\uff0c<code>script_name.py<\/code>\u662f\u9879\u76ee\u4e2d\u7684Python\u811a\u672c\u6587\u4ef6\u3002\u5982\u679c\u9879\u76ee\u4e2d\u5305\u542b\u591a\u4e2a\u811a\u672c\uff0c\u5efa\u8bae\u9010\u4e2a\u8fd0\u884c\u5e76\u68c0\u67e5\u8f93\u51fa\u7ed3\u679c\u3002<\/p>\n<\/p>\n<p><h4>5.2 \u8fd0\u884c\u5355\u5143\u6d4b\u8bd5<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u9879\u76ee\u4e2d\u5305\u542b\u5355\u5143\u6d4b\u8bd5\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u8fd0\u884c\u6d4b\u8bd5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python -m unittest discover<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u81ea\u52a8\u53d1\u73b0\u5e76\u8fd0\u884c\u9879\u76ee\u4e2d\u7684\u6240\u6709\u6d4b\u8bd5\u7528\u4f8b\u3002\u68c0\u67e5\u6d4b\u8bd5\u7ed3\u679c\uff0c\u786e\u4fdd\u6240\u6709\u6d4b\u8bd5\u7528\u4f8b\u90fd\u901a\u8fc7\u3002<\/p>\n<\/p>\n<p><h4>5.3 \u4f7f\u7528\u9759\u6001\u4ee3\u7801\u5206\u6790\u5de5\u5177<\/h4>\n<\/p>\n<p><p>\u9759\u6001\u4ee3\u7801\u5206\u6790\u5de5\u5177\u80fd\u591f\u5e2e\u52a9\u68c0\u6d4b\u4ee3\u7801\u4e2d\u7684\u6f5c\u5728\u95ee\u9898\u3002\u5e38\u89c1\u7684\u9759\u6001\u4ee3\u7801\u5206\u6790\u5de5\u5177\u5305\u62ecflake8\u3001pylint\u7b49\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\u8fd9\u4e9b\u5de5\u5177\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install flake8 pylint<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\uff0c\u8fd0\u884c\u4ee3\u7801\u5206\u6790\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">flake8 .<\/p>\n<p>pylint .<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u68c0\u67e5\u5206\u6790\u7ed3\u679c\uff0c\u4fee\u590d\u62a5\u544a\u4e2d\u7684\u95ee\u9898\u3002<\/p>\n<\/p>\n<hr>\n<p><h3>\u516d\u3001\u5e38\u89c1\u95ee\u9898\u53ca\u89e3\u51b3\u65b9\u6cd5<\/h3>\n<\/p>\n<p><p>\u5728\u66f4\u65b0Python\u7248\u672c\u8fc7\u7a0b\u4e2d\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u5e38\u89c1\u95ee\u9898\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u95ee\u9898\u53ca\u5176\u89e3\u51b3\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<p><h4>6.1 \u4f9d\u8d56\u5305\u4e0d\u517c\u5bb9<\/h4>\n<\/p>\n<p><p>\u5728\u66f4\u65b0Python\u7248\u672c\u540e\uff0c\u67d0\u4e9b\u4f9d\u8d56\u5305\u53ef\u80fd\u4e0d\u517c\u5bb9\uff0c\u5bfc\u81f4\u9879\u76ee\u65e0\u6cd5\u6b63\u5e38\u8fd0\u884c\u3002\u53ef\u4ee5\u5c1d\u8bd5\u4ee5\u4e0b\u89e3\u51b3\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u68c0\u67e5\u4f9d\u8d56\u5305\u7684\u5b98\u65b9\u7f51\u7ad9\u6216\u6587\u6863\uff0c\u67e5\u770b\u662f\u5426\u6709\u66f4\u65b0\u7248\u672c\u652f\u6301\u65b0\u7684Python\u7248\u672c\u3002<\/li>\n<li>\u4f7f\u7528\u865a\u62df\u73af\u5883\u9694\u79bb\u9879\u76ee\u7684\u4f9d\u8d56\u5305\uff0c\u907f\u514d\u4e0e\u7cfb\u7edf\u7ea7\u522b\u7684\u5305\u4ea7\u751f\u51b2\u7a81\u3002<\/li>\n<li>\u5982\u679c\u4f9d\u8d56\u5305\u786e\u5b9e\u4e0d\u517c\u5bb9\uff0c\u53ef\u4ee5\u8003\u8651\u6682\u65f6\u4f7f\u7528\u65e7\u7248\u672c\u7684Python\uff0c\u7b49\u5f85\u4f9d\u8d56\u5305\u66f4\u65b0\u540e\u518d\u8fdb\u884c\u5347\u7ea7\u3002<\/li>\n<\/ul>\n<p><h4>6.2 \u73af\u5883\u53d8\u91cf\u914d\u7f6e\u95ee\u9898<\/h4>\n<\/p>\n<p><p>\u5728\u66f4\u65b0Python\u7248\u672c\u540e\uff0c\u53ef\u80fd\u9700\u8981\u66f4\u65b0\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\uff0c\u4ee5\u786e\u4fdd\u65b0\u7684Python\u7248\u672c\u80fd\u591f\u88ab\u6b63\u786e\u8c03\u7528\u3002\u68c0\u67e5\u4ee5\u4e0b\u914d\u7f6e\u9879\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u786e\u4fddPython\u5b89\u88c5\u8def\u5f84\u5df2\u6dfb\u52a0\u5230\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u4e2d\u3002<\/li>\n<li>\u5728\u4f7f\u7528\u7248\u672c\u7ba1\u7406\u5de5\u5177\uff08\u5982pyenv\uff09\u65f6\uff0c\u786e\u4fdd\u914d\u7f6e\u6587\u4ef6\u5df2\u6b63\u786e\u66f4\u65b0\u5e76\u91cd\u65b0\u52a0\u8f7d\u3002<\/li>\n<\/ul>\n<p><h4>6.3 pip \u5b89\u88c5\u5931\u8d25<\/h4>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0cpip\u5b89\u88c5\u4f9d\u8d56\u5305\u65f6\u53ef\u80fd\u4f1a\u5931\u8d25\u3002\u53ef\u4ee5\u5c1d\u8bd5\u4ee5\u4e0b\u89e3\u51b3\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<ul>\n<li>\n<p>\u66f4\u65b0pip\u5230\u6700\u65b0\u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python -m pip install --upgrade pip<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p>\u4f7f\u7528\u56fd\u5185\u955c\u50cf\u6e90\u52a0\u901f\u5b89\u88c5\u3002\u4f8b\u5982\uff0c\u4f7f\u7528\u6e05\u534e\u5927\u5b66\u7684\u955c\u50cf\u6e90\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install package_name -i https:\/\/pypi.tuna.tsinghua.edu.cn\/simple<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p>\u68c0\u67e5\u7f51\u7edc\u8fde\u63a5\uff0c\u786e\u4fdd\u80fd\u591f\u8bbf\u95ee\u5916\u90e8\u7f51\u7edc\u3002<\/p>\n<\/p>\n<\/li>\n<\/ul>\n<hr>\n<p><h3>\u4e03\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u66f4\u65b0Python\u7248\u672c\u662f\u4fdd\u6301\u5f00\u53d1\u73af\u5883\u6700\u65b0\u548c\u83b7\u5f97\u65b0\u529f\u80fd\u7684\u5fc5\u8981\u6b65\u9aa4\u3002\u672c\u6587\u4ecb\u7ecd\u4e86\u4e09\u79cd\u4e3b\u8981\u7684\u66f4\u65b0\u65b9\u6cd5\uff1a\u4f7f\u7528\u5305\u7ba1\u7406\u5de5\u5177\u3001\u4e0b\u8f7d\u6700\u65b0\u5b89\u88c5\u5305\u4ee5\u53ca\u4f7f\u7528\u7248\u672c\u7ba1\u7406\u5de5\u5177\u3002\u6bcf\u79cd\u65b9\u6cd5\u90fd\u6709\u5176\u4f18\u7f3a\u70b9\uff0c\u7528\u6237\u53ef\u4ee5\u6839\u636e\u5b9e\u9645\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><p>\u6b64\u5916\uff0c\u66f4\u65b0Python\u7248\u672c\u540e\uff0c\u8fd8\u9700\u8981\u66f4\u65b0pip\u548c\u76f8\u5173\u5e93\uff0c\u5e76\u8fdb\u884c\u5145\u5206\u7684\u6d4b\u8bd5\u548c\u9a8c\u8bc1\uff0c\u4ee5\u786e\u4fdd\u65b0\u7248\u672c\u80fd\u591f\u6b63\u5e38\u8fd0\u884c\u3002\u901a\u8fc7\u5408\u7406\u7ba1\u7406\u4f9d\u8d56\u5305\u548c\u4f7f\u7528\u865a\u62df\u73af\u5883\uff0c\u53ef\u4ee5\u6709\u6548\u907f\u514d\u7248\u672c\u51b2\u7a81\u548c\u517c\u5bb9\u6027\u95ee\u9898\u3002<\/p>\n<\/p>\n<p><p>\u5e0c\u671b\u672c\u6587\u80fd\u591f\u5e2e\u52a9\u8bfb\u8005\u987a\u5229\u66f4\u65b0Python\u7248\u672c\uff0c\u5e76\u5728\u65e5\u5e38\u5f00\u53d1\u5de5\u4f5c\u4e2d\u4fdd\u6301\u9ad8\u6548\u548c\u7a33\u5b9a\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u68c0\u67e5\u6211\u5f53\u524d\u5b89\u88c5\u7684Python\u7248\u672c\uff1f<\/strong><br \/>\u8981\u68c0\u67e5\u60a8\u5f53\u524d\u5b89\u88c5\u7684Python\u7248\u672c\uff0c\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u6216\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<code>python --version<\/code> \u6216 <code>python3 --version<\/code>\u3002\u8fd9\u5c06\u663e\u793a\u60a8\u7cfb\u7edf\u4e2d\u5b89\u88c5\u7684Python\u7248\u672c\u53f7\u3002\u5982\u679c\u60a8\u4f7f\u7528\u7684\u662fWindows\uff0c\u53ef\u80fd\u9700\u8981\u4f7f\u7528<code>py --version<\/code>\u547d\u4ee4\u3002<\/p>\n<p><strong>\u66f4\u65b0Python\u7248\u672c\u540e\uff0c\u5982\u4f55\u786e\u4fdd\u6211\u7684\u73af\u5883\u4ecd\u7136\u6b63\u5e38\u5de5\u4f5c\uff1f<\/strong><br \/>\u66f4\u65b0Python\u7248\u672c\u540e\uff0c\u5efa\u8bae\u60a8\u68c0\u67e5\u5e76\u66f4\u65b0\u4f9d\u8d56\u4e8ePython\u7684\u5e93\u548c\u6846\u67b6\u3002\u4f7f\u7528<code>pip list --outdated<\/code>\u547d\u4ee4\u53ef\u4ee5\u5217\u51fa\u6240\u6709\u8fc7\u65f6\u7684\u5e93\uff0c\u63a5\u7740\u4f7f\u7528<code>pip install --upgrade &lt;\u5e93\u540d&gt;<\/code>\u9010\u4e2a\u66f4\u65b0\u3002\u540c\u65f6\uff0c\u786e\u4fdd\u60a8\u7684\u4ee3\u7801\u4e0e\u65b0\u7248\u672c\u517c\u5bb9\uff0c\u5fc5\u8981\u65f6\u53c2\u8003\u5b98\u65b9\u6587\u6863\u8fdb\u884c\u8c03\u6574\u3002<\/p>\n<p><strong>\u5728Windows\u548cmacOS\u4e0a\u66f4\u65b0Python\u7684\u6b65\u9aa4\u6709\u4ec0\u4e48\u4e0d\u540c\uff1f<\/strong><br \/>\u5728Windows\u4e0a\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u6700\u65b0\u7248\u672c\u7684\u5b89\u88c5\u7a0b\u5e8f\u5e76\u8fd0\u884c\u5b83\u3002\u5b89\u88c5\u7a0b\u5e8f\u4f1a\u81ea\u52a8\u68c0\u6d4b\u5e76\u66f4\u65b0\u73b0\u6709\u7248\u672c\u3002\u5728macOS\u4e0a\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528Homebrew\u901a\u8fc7\u547d\u4ee4<code>brew upgrade python<\/code>\u6765\u66f4\u65b0Python\uff0c\u786e\u4fddHomebrew\u662f\u6700\u65b0\u7684\u3002\u4e24\u8005\u7684\u66f4\u65b0\u8fc7\u7a0b\u867d\u7136\u4e0d\u540c\uff0c\u4f46\u90fd\u76f8\u5bf9\u7b80\u5355\uff0c\u5177\u4f53\u6b65\u9aa4\u53ef\u4ee5\u53c2\u8003\u76f8\u5e94\u7684\u6587\u6863\u6216\u793e\u533a\u652f\u6301\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5982\u4f55\u66f4\u65b0Python\u7684\u7248\u672c\uff1a\u4f7f\u7528\u5305\u7ba1\u7406\u5de5\u5177\u3001\u4e0b\u8f7d\u6700\u65b0\u5b89\u88c5\u5305\u3001\u4f7f\u7528\u7248\u672c\u7ba1\u7406\u5de5\u5177 \u66f4\u65b0Python\u7248\u672c\u7684\u4e3b\u8981\u65b9\u6cd5\u6709 [&hellip;]","protected":false},"author":3,"featured_media":1152009,"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\/1152006"}],"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=1152006"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1152006\/revisions"}],"predecessor-version":[{"id":1152010,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1152006\/revisions\/1152010"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1152009"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1152006"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1152006"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1152006"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}