{"id":977159,"date":"2024-12-27T06:27:17","date_gmt":"2024-12-26T22:27:17","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/977159.html"},"modified":"2024-12-27T06:27:20","modified_gmt":"2024-12-26T22:27:20","slug":"mac%e7%b3%bb%e7%bb%9f%e5%a6%82%e4%bd%95%e5%8d%87%e7%ba%a7python","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/977159.html","title":{"rendered":"mac\u7cfb\u7edf\u5982\u4f55\u5347\u7ea7python"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24202529\/5abed3af-d1be-40e5-95da-712152179ffd.webp\" alt=\"mac\u7cfb\u7edf\u5982\u4f55\u5347\u7ea7python\" \/><\/p>\n<p><p> <strong>\u5728macOS\u7cfb\u7edf\u4e2d\u5347\u7ea7Python\uff0c\u4e3b\u8981\u6709\u4ee5\u4e0b\u51e0\u79cd\u65b9\u6cd5\uff1a\u4f7f\u7528Homebrew\u8fdb\u884c\u5347\u7ea7\u3001\u901a\u8fc7Python\u5b98\u65b9\u5b89\u88c5\u5305\u5347\u7ea7\u3001\u4f7f\u7528Pyenv\u7ba1\u7406\u591a\u4e2aPython\u7248\u672c\u3002\u63a8\u8350\u4f7f\u7528Homebrew\uff0c\u56e0\u4e3a\u5b83\u662fmacOS\u4e0a\u6700\u6d41\u884c\u7684\u8f6f\u4ef6\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u6613\u4e8e\u4f7f\u7528\u4e14\u80fd\u81ea\u52a8\u7ba1\u7406\u4f9d\u8d56\u3002<\/strong>\u63a5\u4e0b\u6765\u8be6\u7ec6\u63cf\u8ff0\u901a\u8fc7Homebrew\u5347\u7ea7Python\u7684\u8fc7\u7a0b\u3002<\/p>\n<\/p>\n<p><p>\u8981\u4f7f\u7528Homebrew\u5347\u7ea7Python\uff0c\u9996\u5148\u9700\u8981\u786e\u4fddHomebrew\u5df2\u7ecf\u5b89\u88c5\u5e76\u4e14\u662f\u6700\u65b0\u7248\u672c\u3002\u6253\u5f00\u7ec8\u7aef\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u66f4\u65b0Homebrew\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">brew update<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u66f4\u65b0\u5b8c\u6210\u540e\uff0c\u68c0\u67e5\u5f53\u524d\u5b89\u88c5\u7684Python\u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python3 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\uff0c\u4f7f\u7528Homebrew\u5347\u7ea7Python\u5230\u6700\u65b0\u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">brew upgrade python<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5347\u7ea7\u5b8c\u6210\u540e\uff0c\u518d\u6b21\u68c0\u67e5Python\u7248\u672c\u4ee5\u786e\u4fdd\u5347\u7ea7\u6210\u529f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python3 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4ee5\u4e0a\u6b65\u9aa4\u5c06\u5e2e\u52a9\u60a8\u5728macOS\u4e0a\u901a\u8fc7Homebrew\u8f7b\u677e\u5347\u7ea7Python\u3002<\/p>\n<\/p>\n<p><p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u63a2\u8ba8\u5176\u4ed6\u51e0\u79cd\u5347\u7ea7Python\u7684\u65b9\u6cd5\u4ee5\u53ca\u4e00\u4e9b\u76f8\u5173\u7684\u6ce8\u610f\u4e8b\u9879\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528HOMEBREW\u8fdb\u884c\u5347\u7ea7<\/h3>\n<\/p>\n<p><p>Homebrew \u662f macOS \u4e0a\u5f3a\u5927\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u4f7f\u7528\u5b83\u53ef\u4ee5\u975e\u5e38\u65b9\u4fbf\u5730\u7ba1\u7406\u5404\u79cd\u8f6f\u4ef6\u5305\uff0c\u5305\u62ecPython\u3002<\/p>\n<\/p>\n<p><h4>1.1 \u5b89\u88c5Homebrew<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u60a8\u8fd8\u6ca1\u6709\u5b89\u88c5Homebrew\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\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>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7 <code>brew --version<\/code> \u6765\u9a8c\u8bc1\u5b89\u88c5\u662f\u5426\u6210\u529f\u3002<\/p>\n<\/p>\n<p><h4>1.2 \u4f7f\u7528Homebrew\u5347\u7ea7Python<\/h4>\n<\/p>\n<p><p>\u4e00\u65e6Homebrew\u5b89\u88c5\u5b8c\u6210\u6216\u5df2\u7ecf\u5b58\u5728\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u5347\u7ea7Python\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p>\u66f4\u65b0Homebrew\u5305\u7ba1\u7406\u5668\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">brew update<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p>\u5347\u7ea7Python\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">brew upgrade python<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p>\u68c0\u67e5Python\u7684\u7248\u672c\u4ee5\u786e\u8ba4\u5347\u7ea7\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python3 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>Homebrew\u4f1a\u81ea\u52a8\u7ba1\u7406Python\u7684\u4f9d\u8d56\u5173\u7cfb\u5e76\u786e\u4fdd\u6240\u6709\u76f8\u5173\u7684\u5305\u90fd\u88ab\u66f4\u65b0\u3002\u8fd9\u79cd\u65b9\u6cd5\u7684\u4f18\u52bf\u5728\u4e8e\u81ea\u52a8\u5316\u7a0b\u5ea6\u9ad8\uff0c\u4f7f\u7528\u65b9\u4fbf\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u901a\u8fc7PYTHON\u5b98\u65b9\u5b89\u88c5\u5305\u8fdb\u884c\u5347\u7ea7<\/h3>\n<\/p>\n<p><p>\u901a\u8fc7Python\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u5e76\u5b89\u88c5\u6700\u65b0\u7684Python\u7248\u672c\u662f\u53e6\u4e00\u79cd\u5e38\u89c1\u7684\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><h4>2.1 \u4e0b\u8f7dPython\u5b89\u88c5\u5305<\/h4>\n<\/p>\n<p><p>\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9<a href=\"https:\/\/www.python.org\/\">Python.org<\/a>\u5e76\u4e0b\u8f7d\u9002\u7528\u4e8emacOS\u7684\u6700\u65b0\u7248\u672c\u7684Python\u5b89\u88c5\u5305\u3002<\/p>\n<\/p>\n<p><h4>2.2 \u5b89\u88c5Python<\/h4>\n<\/p>\n<p><p>\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u53cc\u51fb\u5b89\u88c5\u5305\u5e76\u6309\u7167\u5b89\u88c5\u5411\u5bfc\u7684\u6307\u793a\u8fdb\u884c\u64cd\u4f5c\u3002\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u53ef\u4ee5\u9009\u62e9\u5c06Python\u6dfb\u52a0\u5230PATH\u73af\u5883\u53d8\u91cf\u4e2d\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u5728\u7ec8\u7aef\u4e2d\u76f4\u63a5\u4f7f\u7528<code>python3<\/code>\u547d\u4ee4\u3002<\/p>\n<\/p>\n<p><h4>2.3 \u9a8c\u8bc1\u5b89\u88c5<\/h4>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6253\u5f00\u7ec8\u7aef\u5e76\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u786e\u4fdd\u65b0\u7248\u672c\u5b89\u88c5\u6210\u529f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python3 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u5b98\u65b9\u5b89\u88c5\u5305\u5347\u7ea7Python\u7684\u597d\u5904\u5728\u4e8e\u53ef\u4ee5\u83b7\u53d6\u5230\u6700\u65b0\u7a33\u5b9a\u7248\u672c\uff0c\u4f46\u9700\u8981\u624b\u52a8\u7ba1\u7406\u5b89\u88c5\u8fc7\u7a0b\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528PYENV\u7ba1\u7406\u591a\u4e2aPYTHON\u7248\u672c<\/h3>\n<\/p>\n<p><p>Pyenv\u662f\u4e00\u4e2a\u975e\u5e38\u6d41\u884c\u7684Python\u7248\u672c\u7ba1\u7406\u5de5\u5177\uff0c\u5b83\u5141\u8bb8\u60a8\u5728\u540c\u4e00\u53f0\u673a\u5668\u4e0a\u5b89\u88c5\u548c\u7ba1\u7406\u591a\u4e2aPython\u7248\u672c\u3002<\/p>\n<\/p>\n<p><h4>3.1 \u5b89\u88c5Pyenv<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528Homebrew\u6765\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>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u60a8\u9700\u8981\u5c06Pyenv\u6dfb\u52a0\u5230shell\u7684\u521d\u59cb\u5316\u6587\u4ef6\u4e2d\uff0c\u4f8b\u5982<code>~\/.bash_profile<\/code>\u6216<code>~\/.zshrc<\/code>\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">echo &#39;export PYENV_ROOT=&quot;$HOME\/.pyenv&quot;&#39; &gt;&gt; ~\/.zshrc<\/p>\n<p>echo &#39;export PATH=&quot;$PYENV_ROOT\/bin:$PATH&quot;&#39; &gt;&gt; ~\/.zshrc<\/p>\n<p>echo &#39;eval &quot;$(pyenv init --path)&quot;&#39; &gt;&gt; ~\/.zshrc<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\uff0c\u91cd\u65b0\u542f\u52a8\u7ec8\u7aef\u6216\u8fd0\u884c<code>source ~\/.zshrc<\/code>\u4ee5\u4f7f\u66f4\u6539\u751f\u6548\u3002<\/p>\n<\/p>\n<p><h4>3.2 \u4f7f\u7528Pyenv\u5b89\u88c5Python<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528Pyenv\u53ef\u4ee5\u5b89\u88c5\u7279\u5b9a\u7248\u672c\u7684Python\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pyenv install 3.x.x<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5c063.x.x\u66ff\u6362\u4e3a\u60a8\u5e0c\u671b\u5b89\u88c5\u7684Python\u7248\u672c\u53f7\u3002<\/p>\n<\/p>\n<p><h4>3.3 \u8bbe\u7f6e\u9ed8\u8ba4Python\u7248\u672c<\/h4>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u8bbe\u7f6e\u9ed8\u8ba4\u7684Python\u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pyenv global 3.x.x<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6837\uff0c\u60a8\u5c31\u53ef\u4ee5\u5728\u7ec8\u7aef\u4e2d\u4f7f\u7528\u6307\u5b9a\u7248\u672c\u7684Python\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u4f7f\u7528ANACONDA\u8fdb\u884cPython\u7ba1\u7406<\/h3>\n<\/p>\n<p><p>Anaconda\u662f\u4e00\u79cd\u6d41\u884c\u7684\u6570\u636e\u79d1\u5b66\u5e73\u53f0\uff0c\u5e38\u7528\u4e8e\u79d1\u5b66\u8ba1\u7b97\u548c\u6570\u636e\u5206\u6790\u3002\u5b83\u81ea\u5e26\u4e86Python\uff0c\u5e76\u4e14\u901a\u8fc7Conda\u5305\u7ba1\u7406\u5668\u53ef\u4ee5\u8f7b\u677e\u7ba1\u7406Python\u7248\u672c\u3002<\/p>\n<\/p>\n<p><h4>4.1 \u4e0b\u8f7d\u5e76\u5b89\u88c5Anaconda<\/h4>\n<\/p>\n<p><p>\u8bbf\u95eeAnaconda\u5b98\u65b9\u7f51\u7ad9\u5e76\u4e0b\u8f7d\u9002\u7528\u4e8emacOS\u7684\u5b89\u88c5\u5305\u3002\u5b8c\u6210\u4e0b\u8f7d\u540e\uff0c\u53cc\u51fb\u5b89\u88c5\u5305\u5e76\u6309\u7167\u6307\u793a\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n<\/p>\n<p><h4>4.2 \u4f7f\u7528Conda\u7ba1\u7406Python\u7248\u672c<\/h4>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528Conda\u547d\u4ee4\u6765\u7ba1\u7406Python\u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">conda update python<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6b64\u547d\u4ee4\u5c06\u66f4\u65b0Anaconda\u73af\u5883\u4e2d\u7684Python\u5230\u6700\u65b0\u7248\u672c\u3002<\/p>\n<\/p>\n<p><h4>4.3 \u521b\u5efa\u4e0d\u540c\u7684Python\u73af\u5883<\/h4>\n<\/p>\n<p><p>Conda\u5141\u8bb8\u60a8\u521b\u5efa\u4e0d\u540c\u7684\u73af\u5883\uff0c\u6bcf\u4e2a\u73af\u5883\u53ef\u4ee5\u6709\u4e0d\u540c\u7248\u672c\u7684Python\u548c\u5305\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">conda create --name myenv python=3.x<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6fc0\u6d3b\u8fd9\u4e2a\u73af\u5883\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">conda activate myenv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>Anaconda\u7684\u4f18\u70b9\u5728\u4e8e\u5b83\u7684\u79d1\u5b66\u8ba1\u7b97\u548c\u6570\u636e\u5206\u6790\u5e93\u4e30\u5bcc\uff0c\u9002\u5408\u9700\u8981\u8fd9\u4e9b\u529f\u80fd\u7684\u7528\u6237\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u6ce8\u610f\u4e8b\u9879\u53ca\u6700\u4f73\u5b9e\u8df5<\/h3>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5907\u4efd\u73af\u5883<\/strong>\uff1a\u5728\u8fdb\u884cPython\u5347\u7ea7\u4e4b\u524d\uff0c\u5efa\u8bae\u5907\u4efd\u5f53\u524d\u7684Python\u73af\u5883\u548c\u91cd\u8981\u7684\u9879\u76ee\uff0c\u4ee5\u514d\u51fa\u73b0\u517c\u5bb9\u6027\u95ee\u9898\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u66f4\u65b0\u5305\u4f9d\u8d56<\/strong>\uff1aPython\u5347\u7ea7\u540e\uff0c\u53ef\u80fd\u9700\u8981\u91cd\u65b0\u5b89\u88c5\u6216\u66f4\u65b0\u9879\u76ee\u4e2d\u7684\u4f9d\u8d56\u5305\uff0c\u786e\u4fdd\u517c\u5bb9\u6027\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6d4b\u8bd5\u73af\u5883<\/strong>\uff1a\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u5347\u7ea7Python\u524d\uff0c\u5efa\u8bae\u5728\u6d4b\u8bd5\u73af\u5883\u4e2d\u8fdb\u884c\u9a8c\u8bc1\uff0c\u4ee5\u907f\u514d\u5bf9\u7cfb\u7edf\u6216\u5e94\u7528\u9020\u6210\u5f71\u54cd\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7248\u672c\u7ba1\u7406\u5de5\u5177<\/strong>\uff1a\u4f7f\u7528Pyenv\u6216Conda\u8fd9\u6837\u7684\u7248\u672c\u7ba1\u7406\u5de5\u5177\u53ef\u4ee5\u8ba9\u60a8\u5728\u4e0d\u540c\u9879\u76ee\u4e2d\u7075\u6d3b\u4f7f\u7528\u4e0d\u540c\u7684Python\u7248\u672c\uff0c\u662f\u4e00\u79cd\u503c\u5f97\u63a8\u8350\u7684\u5b9e\u8df5\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u65b9\u6cd5\uff0c\u60a8\u53ef\u4ee5\u5728macOS\u7cfb\u7edf\u4e0a\u7075\u6d3b\u5730\u5347\u7ea7\u548c\u7ba1\u7406Python\u7248\u672c\uff0c\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\u5c06\u5e2e\u52a9\u60a8\u66f4\u9ad8\u6548\u5730\u8fdb\u884c\u5f00\u53d1\u548c<a href=\"https:\/\/docs.pingcode.com\/blog\/project-management\/23316.html\" target=\"_blank\">\u9879\u76ee\u7ba1\u7406<\/a>\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u68c0\u67e5\u5f53\u524dMac\u7cfb\u7edf\u4e2d\u5b89\u88c5\u7684Python\u7248\u672c\uff1f<\/strong><br \/>\u60a8\u53ef\u4ee5\u901a\u8fc7\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165 <code>python --version<\/code> \u6216 <code>python3 --version<\/code> \u6765\u68c0\u67e5\u5f53\u524d\u5b89\u88c5\u7684Python\u7248\u672c\u3002\u8fd9\u5c06\u663e\u793a\u60a8\u7cfb\u7edf\u4e0a\u5b89\u88c5\u7684Python\u7684\u786e\u5207\u7248\u672c\u53f7\uff0c\u4ece\u800c\u5e2e\u52a9\u60a8\u5224\u65ad\u662f\u5426\u9700\u8981\u5347\u7ea7\u3002<\/p>\n<p><strong>\u5728Mac\u4e0a\u5347\u7ea7Python\u65f6\u9700\u8981\u6ce8\u610f\u54ea\u4e9b\u4e8b\u9879\uff1f<\/strong><br \/>\u5728\u8fdb\u884cPython\u5347\u7ea7\u524d\uff0c\u5efa\u8bae\u60a8\u5907\u4efd\u91cd\u8981\u7684\u9879\u76ee\u548c\u73af\u5883\u914d\u7f6e\u3002\u67d0\u4e9b\u9879\u76ee\u53ef\u80fd\u4f9d\u8d56\u4e8e\u7279\u5b9a\u7248\u672c\u7684Python\uff0c\u56e0\u6b64\u5728\u5347\u7ea7\u540e\uff0c\u786e\u4fdd\u68c0\u67e5\u6240\u6709\u9879\u76ee\u7684\u517c\u5bb9\u6027\u3002\u6b64\u5916\uff0c\u60a8\u53ef\u4ee5\u8003\u8651\u4f7f\u7528\u865a\u62df\u73af\u5883\u5de5\u5177\uff08\u5982venv\u6216virtualenv\uff09\u6765\u7ba1\u7406\u4e0d\u540c\u9879\u76ee\u7684Python\u7248\u672c\uff0c\u907f\u514d\u6f5c\u5728\u7684\u51b2\u7a81\u3002<\/p>\n<p><strong>\u6709\u54ea\u4e9b\u65b9\u6cd5\u53ef\u4ee5\u5728Mac\u4e0a\u5347\u7ea7Python\uff1f<\/strong><br \/>\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\u5347\u7ea7Python\uff0c\u5305\u62ec\u4f7f\u7528Homebrew\u3001\u4ecePython\u5b98\u7f51\u4e0b\u8f7d\u5b89\u88c5\u5305\u6216\u4f7f\u7528pyenv\u7b49\u7248\u672c\u7ba1\u7406\u5de5\u5177\u3002Homebrew\u662f\u4e00\u4e2a\u6d41\u884c\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u901a\u8fc7\u547d\u4ee4 <code>brew update<\/code> \u548c <code>brew upgrade python<\/code> \u53ef\u4ee5\u8f7b\u677e\u5730\u8fdb\u884c\u5347\u7ea7\u3002\u800c\u5982\u679c\u60a8\u9009\u62e9\u4ece\u5b98\u7f51\u4e0b\u8f7d\u5b89\u88c5\u5305\uff0c\u786e\u4fdd\u4e0b\u8f7d\u4e0e\u60a8\u7684\u7cfb\u7edf\u517c\u5bb9\u7684\u7248\u672c\u3002\u4f7f\u7528pyenv\u5219\u53ef\u4ee5\u8ba9\u60a8\u5728\u540c\u4e00\u53f0\u673a\u5668\u4e0a\u8f7b\u677e\u7ba1\u7406\u591a\u4e2aPython\u7248\u672c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728macOS\u7cfb\u7edf\u4e2d\u5347\u7ea7Python\uff0c\u4e3b\u8981\u6709\u4ee5\u4e0b\u51e0\u79cd\u65b9\u6cd5\uff1a\u4f7f\u7528Homebrew\u8fdb\u884c\u5347\u7ea7\u3001\u901a\u8fc7Python\u5b98\u65b9\u5b89\u88c5 [&hellip;]","protected":false},"author":3,"featured_media":977164,"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\/977159"}],"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=977159"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/977159\/revisions"}],"predecessor-version":[{"id":977165,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/977159\/revisions\/977165"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/977164"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=977159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=977159"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=977159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}