{"id":954902,"date":"2024-12-27T02:06:12","date_gmt":"2024-12-26T18:06:12","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/954902.html"},"modified":"2024-12-27T02:06:14","modified_gmt":"2024-12-26T18:06:14","slug":"%e5%a6%82%e4%bd%95%e4%b8%8b%e8%bd%bdmac%e7%89%88python","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/954902.html","title":{"rendered":"\u5982\u4f55\u4e0b\u8f7dmac\u7248python"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25094858\/f0db5286-00ad-45be-82c8-567dd2fd8670.webp\" alt=\"\u5982\u4f55\u4e0b\u8f7dmac\u7248python\" \/><\/p>\n<p><p> <strong>\u8981\u4e0b\u8f7dMac\u7248Python\uff0c\u4f60\u9700\u8981\u8bbf\u95eePython\u7684\u5b98\u65b9\u7f51\u7ad9\u3001\u9009\u62e9\u5408\u9002\u7684Python\u7248\u672c\u3001\u4e0b\u8f7d\u5b89\u88c5\u5305\u5e76\u6309\u7167\u5b89\u88c5\u5411\u5bfc\u8fdb\u884c\u5b89\u88c5\u3002\u53ef\u4ee5\u4f7f\u7528Homebrew\u5b89\u88c5\uff0c\u8fd9\u662fMac\u4e0a\u6d41\u884c\u7684\u8f6f\u4ef6\u5305\u7ba1\u7406\u5de5\u5177\u4e4b\u4e00\u3002<\/strong><\/p>\n<\/p>\n<p><p><strong>\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\uff1a<\/strong><br \/>\u9996\u5148\uff0c\u8bbf\u95eePython\u7684\u5b98\u65b9\u7f51\u7ad9\uff08<a href=\"https:\/\/www.python.org\/%EF%BC%89%EF%BC%8C%E7%82%B9%E5%87%BB%E5%AF%BC%E8%88%AA%E6%A0%8F%E4%B8%AD%E7%9A%84%E2%80%9CDownloads%E2%80%9D%E9%80%89%E9%A1%B9%E3%80%82%E7%BD%91%E7%AB%99%E4%BC%9A%E8%87%AA%E5%8A%A8%E8%AF%86%E5%88%AB%E4%BD%A0%E7%9A%84%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E5%B9%B6%E6%8E%A8%E8%8D%90%E5%90%88%E9%80%82%E7%9A%84Python%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%89%93%E5%BC%80.dmg%E6%96%87%E4%BB%B6%E5%B9%B6%E6%8C%89%E7%85%A7%E6%8F%90%E7%A4%BA%E8%BF%9B%E8%A1%8C%E5%AE%89%E8%A3%85%E3%80%82%E8%BF%99%E7%A7%8D%E6%96%B9%E6%B3%95%E9%80%82%E5%90%88%E5%A4%A7%E5%A4%9A%E6%95%B0%E7%94%A8%E6%88%B7%EF%BC%8C%E7%89%B9%E5%88%AB%E6%98%AF%E5%88%9D%E5%AD%A6%E8%80%85%EF%BC%8C%E5%9B%A0%E4%B8%BA%E5%AE%83%E7%AE%80%E5%8D%95%E7%9B%B4%E8%A7%82%E3%80%82\">https:\/\/www.python.org\/\uff09\uff0c\u70b9\u51fb\u5bfc\u822a\u680f\u4e2d\u7684\u201cDownloads\u201d\u9009\u9879\u3002\u7f51\u7ad9\u4f1a\u81ea\u52a8\u8bc6\u522b\u4f60\u7684\u64cd\u4f5c\u7cfb\u7edf\u5e76\u63a8\u8350\u5408\u9002\u7684Python\u7248\u672c\u3002\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u6253\u5f00.dmg\u6587\u4ef6\u5e76\u6309\u7167\u63d0\u793a\u8fdb\u884c\u5b89\u88c5\u3002\u8fd9\u79cd\u65b9\u6cd5\u9002\u5408\u5927\u591a\u6570\u7528\u6237\uff0c\u7279\u522b\u662f\u521d\u5b66\u8005\uff0c\u56e0\u4e3a\u5b83\u7b80\u5355\u76f4\u89c2\u3002<\/a><\/p>\n<\/p>\n<p><p><strong>\u4f7f\u7528Homebrew\u5b89\u88c5\uff1a<\/strong><br \/>\u5bf9\u4e8e\u559c\u6b22\u4f7f\u7528\u547d\u4ee4\u884c\u7684\u7528\u6237\uff0c\u53ef\u4ee5\u901a\u8fc7Homebrew\u6765\u5b89\u88c5Python\u3002\u8fd9\u79cd\u65b9\u6cd5\u7b80\u6d01\u9ad8\u6548\uff0c\u5c24\u5176\u9002\u7528\u4e8e\u5f00\u53d1\u4eba\u5458\u3002\u9996\u5148\uff0c\u786e\u4fddHomebrew\u5df2\u5b89\u88c5\uff0c\u7136\u540e\u5728\u7ec8\u7aef\u8f93\u5165<code>brew install python<\/code>\u3002Homebrew\u4f1a\u81ea\u52a8\u4e0b\u8f7d\u5e76\u5b89\u88c5\u6700\u65b0\u7684Python\u7248\u672c\uff0c\u540c\u65f6\u5904\u7406\u597d\u4f9d\u8d56\u95ee\u9898\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u7ec8\u7aef\u8f93\u5165<code>python3 --version<\/code>\u6765\u9a8c\u8bc1\u5b89\u88c5\u662f\u5426\u6210\u529f\u3002<\/p>\n<\/p>\n<hr>\n<p><p>\u4e00\u3001\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9<\/p>\n<\/p>\n<p><p>Python\u5b98\u65b9\u7f51\u7ad9\u662f\u4e0b\u8f7dPython\u8f6f\u4ef6\u7684\u4e3b\u8981\u6e20\u9053\u4e4b\u4e00\u3002\u901a\u8fc7\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\uff0c\u4e0d\u4ec5\u53ef\u4ee5\u83b7\u5f97\u6700\u65b0\u7684\u7248\u672c\uff0c\u8fd8\u80fd\u5f97\u5230\u5b89\u5168\u53ef\u9760\u7684\u5b89\u88c5\u5305\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u9009\u62e9\u5408\u9002\u7684\u7248\u672c<\/strong><\/p>\n<\/p>\n<p><p>\u5f53\u4f60\u8fdb\u5165Python\u7684\u5b98\u65b9\u7f51\u7ad9\uff08<a href=\"https:\/\/www.python.org\/%EF%BC%89%E5%90%8E%EF%BC%8C%E7%BD%91%E7%AB%99%E4%BC%9A%E8%87%AA%E5%8A%A8%E8%AF%86%E5%88%AB%E4%BD%A0%E7%9A%84%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E5%B9%B6%E6%8E%A8%E8%8D%90%E9%80%82%E5%90%88%E7%9A%84Python%E7%89%88%E6%9C%AC%E3%80%82%E9%80%9A%E5%B8%B8%E6%83%85%E5%86%B5%E4%B8%8B%EF%BC%8C%E4%BD%A0%E4%BC%9A%E7%9C%8B%E5%88%B0%E2%80%9CDownload\">https:\/\/www.python.org\/\uff09\u540e\uff0c\u7f51\u7ad9\u4f1a\u81ea\u52a8\u8bc6\u522b\u4f60\u7684\u64cd\u4f5c\u7cfb\u7edf\u5e76\u63a8\u8350\u9002\u5408\u7684Python\u7248\u672c\u3002\u901a\u5e38\u60c5\u51b5\u4e0b\uff0c\u4f60\u4f1a\u770b\u5230\u201cDownload<\/a> Python X.Y.Z\u201d\u8fd9\u6837\u7684\u6309\u94ae\uff0c\u70b9\u51fb\u5373\u53ef\u4e0b\u8f7d\u3002\u9009\u62e9\u5408\u9002\u7684\u7248\u672c\u975e\u5e38\u91cd\u8981\uff0c\u901a\u5e38\u5efa\u8bae\u4f7f\u7528\u6700\u65b0\u7684\u7a33\u5b9a\u7248\u672c\uff0c\u56e0\u4e3a\u5b83\u5305\u542b\u6700\u65b0\u7684\u529f\u80fd\u548c\u5b89\u5168\u8865\u4e01\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5\u8fc7\u7a0b<\/strong><\/p>\n<\/p>\n<p><p>\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u53cc\u51fb.dmg\u6587\u4ef6\u6253\u5f00\u5b89\u88c5\u5305\u3002\u63a5\u4e0b\u6765\u4f1a\u770b\u5230\u5b89\u88c5\u5411\u5bfc\uff0c\u6309\u7167\u63d0\u793a\u70b9\u51fb\u201c\u7ee7\u7eed\u201d\u6309\u94ae\uff0c\u4e00\u76f4\u5230\u5b89\u88c5\u5b8c\u6210\u3002\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u8f93\u5165\u7ba1\u7406\u5458\u5bc6\u7801\u3002\u8fd9\u662f\u56e0\u4e3aPython\u4f1a\u88ab\u5b89\u88c5\u5230\u7cfb\u7edf\u7684\u5e94\u7528\u7a0b\u5e8f\u76ee\u5f55\u4e0b\uff0c\u5e76\u5bf9\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u8fdb\u884c\u914d\u7f6e\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e8c\u3001\u901a\u8fc7Homebrew\u5b89\u88c5Python<\/p>\n<\/p>\n<p><p>Homebrew\u662fMac OS\u4e0a\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u80fd\u591f\u7b80\u5316\u8f6f\u4ef6\u5b89\u88c5\u8fc7\u7a0b\u3002\u5b83\u4f1a\u81ea\u52a8\u5904\u7406\u4f9d\u8d56\u5173\u7cfb\uff0c\u56e0\u6b64\u662f\u5f00\u53d1\u4eba\u5458\u5e38\u7528\u7684\u5de5\u5177\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5b89\u88c5Homebrew<\/strong><\/p>\n<\/p>\n<p><p>\u5982\u679c\u4f60\u8fd8\u6ca1\u6709\u5b89\u88c5Homebrew\uff0c\u53ef\u4ee5\u901a\u8fc7\u7ec8\u7aef\u8f93\u5165\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>\u6309\u7167\u63d0\u793a\u5b8c\u6210\u5b89\u88c5\u540e\uff0c\u4f60\u53ef\u4ee5\u5728\u7ec8\u7aef\u4e2d\u4f7f\u7528<code>brew<\/code>\u547d\u4ee4\u6765\u7ba1\u7406\u8f6f\u4ef6\u5305\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5Python<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528Homebrew\u5b89\u88c5Python\u975e\u5e38\u7b80\u5355\u3002\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">brew install python<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>Homebrew\u4f1a\u81ea\u52a8\u4e0b\u8f7d\u5e76\u5b89\u88c5\u6700\u65b0\u7684Python\u7248\u672c\uff0c\u540c\u65f6\u914d\u7f6e\u597d\u73af\u5883\u53d8\u91cf\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u9a8c\u8bc1Python\u662f\u5426\u6b63\u786e\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python3 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u770b\u5230Python\u7684\u7248\u672c\u4fe1\u606f\uff0c\u8bf4\u660e\u5b89\u88c5\u6210\u529f\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/p>\n<\/p>\n<p><p>\u867d\u7136\u5927\u591a\u6570\u60c5\u51b5\u4e0bPython\u7684\u5b89\u88c5\u7a0b\u5e8f\u4f1a\u81ea\u52a8\u914d\u7f6e\u73af\u5883\u53d8\u91cf\uff0c\u4f46\u6709\u65f6\u53ef\u80fd\u9700\u8981\u624b\u52a8\u8c03\u6574\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u9a8c\u8bc1\u8def\u5f84<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff0c\u67e5\u770bPython\u7684\u5b89\u88c5\u8def\u5f84\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">which python3<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u8f93\u51faPython\u53ef\u6267\u884c\u6587\u4ef6\u7684\u8def\u5f84\uff0c\u901a\u5e38\u5728<code>\/usr\/local\/bin\/python3<\/code>\u3002\u786e\u4fdd\u8fd9\u4e2a\u8def\u5f84\u5728\u4f60\u7684<code>$PATH<\/code>\u73af\u5883\u53d8\u91cf\u4e2d\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u914d\u7f6e.bash_profile\u6216.zshrc<\/strong><\/p>\n<\/p>\n<p><p>\u5982\u679c\u9700\u8981\u624b\u52a8\u914d\u7f6e\uff0c\u53ef\u4ee5\u7f16\u8f91\u4f60\u7684shell\u914d\u7f6e\u6587\u4ef6\uff08\u4f8b\u5982<code>~\/.bash_profile<\/code>\u6216<code>~\/.zshrc<\/code>\uff09\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">export PATH=&quot;\/usr\/local\/bin:$PATH&quot;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4fdd\u5b58\u6587\u4ef6\u540e\uff0c\u8f93\u5165<code>source ~\/.bash_profile<\/code>\u6216<code>source ~\/.zshrc<\/code>\u4f7f\u66f4\u6539\u751f\u6548\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u56db\u3001\u5b89\u88c5Python\u5305\u7ba1\u7406\u5de5\u5177<\/p>\n<\/p>\n<p><p>Python\u7684\u5f3a\u5927\u4e4b\u5904\u5728\u4e8e\u5176\u4e30\u5bcc\u7684\u7b2c\u4e09\u65b9\u5e93\uff0c\u800c\u8fd9\u4e9b\u5e93\u901a\u5e38\u901a\u8fc7pip\u8fdb\u884c\u7ba1\u7406\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>pip\u5b89\u88c5\u4e0e\u4f7f\u7528<\/strong><\/p>\n<\/p>\n<p><p>Python\u5b89\u88c5\u5b8c\u6210\u540e\uff0cpip\u901a\u5e38\u4f1a\u81ea\u52a8\u5b89\u88c5\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u68c0\u67e5pip\u662f\u5426\u5b89\u88c5\u6210\u529f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip3 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679cpip\u5df2\u5b89\u88c5\uff0c\u53ef\u4ee5\u4f7f\u7528\u5b83\u6765\u5b89\u88c5Python\u5305\u3002\u4f8b\u5982\uff0c\u5b89\u88c5requests\u5e93\uff0c\u53ef\u4ee5\u8f93\u5165\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip3 install requests<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528virtualenv\u521b\u5efa\u865a\u62df\u73af\u5883<\/strong><\/p>\n<\/p>\n<p><p>\u4e3a\u4e86\u907f\u514d\u4e0d\u540c\u9879\u76ee\u4e4b\u95f4\u7684\u4f9d\u8d56\u51b2\u7a81\uff0c\u5efa\u8bae\u4f7f\u7528virtualenv\u521b\u5efa\u72ec\u7acb\u7684Python\u73af\u5883\u3002\u9996\u5148\u5b89\u88c5virtualenv\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip3 install virtualenv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\u5728\u4f60\u7684\u9879\u76ee\u76ee\u5f55\u4e2d\u521b\u5efa\u865a\u62df\u73af\u5883\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">virtualenv venv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6fc0\u6d3b\u865a\u62df\u73af\u5883\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">source venv\/bin\/activate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6fc0\u6d3b\u540e\uff0c\u4f60\u53ef\u4ee5\u5728\u865a\u62df\u73af\u5883\u4e2d\u5b89\u88c5\u6240\u9700\u7684Python\u5305\uff0c\u800c\u4e0d\u4f1a\u5f71\u54cd\u5168\u5c40Python\u73af\u5883\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e94\u3001\u4f7f\u7528IDLE\u548c\u5176\u4ed6IDE<\/p>\n<\/p>\n<p><p>\u867d\u7136Python\u81ea\u5e26\u4e86IDLE\u4f5c\u4e3a\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff0c\u4f46\u8bb8\u591a\u5f00\u53d1\u8005\u66f4\u559c\u6b22\u4f7f\u7528\u529f\u80fd\u66f4\u5f3a\u5927\u7684IDE\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4f7f\u7528IDLE<\/strong><\/p>\n<\/p>\n<p><p>IDLE\u662fPython\u81ea\u5e26\u7684\u8f7b\u91cf\u7ea7IDE\uff0c\u9002\u5408\u521d\u5b66\u8005\u4f7f\u7528\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u5e94\u7528\u7a0b\u5e8f\u5217\u8868\u6216\u7ec8\u7aef\u8f93\u5165<code>idle<\/code>\u547d\u4ee4\u6765\u542f\u52a8IDLE\u3002IDLE\u63d0\u4f9b\u4e86\u57fa\u672c\u7684\u4ee3\u7801\u7f16\u8f91\u3001\u8fd0\u884c\u548c\u8c03\u8bd5\u529f\u80fd\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u9009\u62e9\u5176\u4ed6IDE<\/strong><\/p>\n<\/p>\n<p><p>\u5bf9\u4e8e\u9700\u8981\u66f4\u5f3a\u5927\u529f\u80fd\u7684\u5f00\u53d1\u8005\uff0c\u53ef\u4ee5\u9009\u62e9\u4ee5\u4e0bIDE\uff1a<\/p>\n<\/p>\n<ul>\n<li><strong>PyCharm<\/strong>\uff1a\u529f\u80fd\u5f3a\u5927\u7684Python IDE\uff0c\u652f\u6301\u4ee3\u7801\u8865\u5168\u3001\u8c03\u8bd5\u3001\u7248\u672c\u63a7\u5236\u7b49\u529f\u80fd\u3002<\/li>\n<li><strong>Visual Studio Code<\/strong>\uff1a\u8f7b\u91cf\u7ea7\u7f16\u8f91\u5668\uff0c\u901a\u8fc7\u5b89\u88c5Python\u6269\u5c55\u53ef\u4ee5\u53d8\u6210\u529f\u80fd\u9f50\u5168\u7684IDE\u3002<\/li>\n<li><strong>Atom<\/strong>\uff1a\u53ef\u5b9a\u5236\u7684\u7f16\u8f91\u5668\uff0c\u901a\u8fc7\u5b89\u88c5\u63d2\u4ef6\u652f\u6301Python\u5f00\u53d1\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><p>\u516d\u3001\u89e3\u51b3\u53ef\u80fd\u51fa\u73b0\u7684\u95ee\u9898<\/p>\n<\/p>\n<p><p>\u5728\u5b89\u88c5\u548c\u4f7f\u7528Python\u65f6\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u5e38\u89c1\u95ee\u9898\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u7248\u672c\u51b2\u7a81<\/strong><\/p>\n<\/p>\n<p><p>\u5982\u679c\u4f60\u7684\u7cfb\u7edf\u4e0a\u5df2\u7ecf\u5b89\u88c5\u4e86\u591a\u4e2a\u7248\u672c\u7684Python\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u547d\u4ee4\u51b2\u7a81\u3002\u786e\u4fdd\u5728\u4f7f\u7528\u547d\u4ee4\u65f6\u660e\u786e\u6307\u5b9a\u7248\u672c\u53f7\uff0c\u4f8b\u5982\u4f7f\u7528<code>python3<\/code>\u548c<code>pip3<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6743\u9650\u95ee\u9898<\/strong><\/p>\n<\/p>\n<p><p>\u6709\u65f6\u5b89\u88c5Python\u5305\u4f1a\u9047\u5230\u6743\u9650\u95ee\u9898\uff0c\u7279\u522b\u662f\u5728\u5168\u5c40\u73af\u5883\u4e2d\u3002\u8fd9\u65f6\u53ef\u4ee5\u4f7f\u7528<code>sudo<\/code>\u547d\u4ee4\u63d0\u5347\u6743\u9650\uff0c\u4f46\u66f4\u63a8\u8350\u4f7f\u7528virtualenv\u521b\u5efa\u865a\u62df\u73af\u5883\u6765\u907f\u514d\u6743\u9650\u95ee\u9898\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7f51\u7edc\u95ee\u9898<\/strong><\/p>\n<\/p>\n<p><p>\u4e0b\u8f7d\u548c\u5b89\u88c5Python\u5305\u65f6\uff0c\u53ef\u80fd\u4f1a\u56e0\u4e3a\u7f51\u7edc\u95ee\u9898\u5bfc\u81f4\u5931\u8d25\u3002\u53ef\u4ee5\u5c1d\u8bd5\u4f7f\u7528\u56fd\u5185\u955c\u50cf\u6e90\uff0c\u4f8b\u5982\u6e05\u534e\u5927\u5b66\u7684\u955c\u50cf\u6e90\uff0c\u52a0\u5feb\u4e0b\u8f7d\u901f\u5ea6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip3 install -i https:\/\/pypi.tuna.tsinghua.edu.cn\/simple some-package<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u4f60\u53ef\u4ee5\u987a\u5229\u5730\u5728Mac\u4e0a\u5b89\u88c5\u548c\u914d\u7f6ePython\uff0c\u5e76\u5f00\u59cb\u4f60\u7684\u5f00\u53d1\u65c5\u7a0b\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Mac\u4e0a\u627e\u5230\u9002\u5408\u7684Python\u7248\u672c\u8fdb\u884c\u4e0b\u8f7d\uff1f<\/strong><br \/>\u5728Mac\u4e0a\u4e0b\u8f7dPython\u65f6\uff0c\u60a8\u53ef\u4ee5\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9\uff08python.org\uff09\u6765\u627e\u5230\u9002\u5408\u60a8\u7cfb\u7edf\u7684\u7248\u672c\u3002\u901a\u5e38\uff0c\u60a8\u4f1a\u770b\u5230\u6700\u65b0\u7684\u7a33\u5b9a\u7248\u672c\u548c\u4e00\u4e9b\u65e7\u7248\u672c\u4f9b\u60a8\u9009\u62e9\u3002\u786e\u4fdd\u9009\u62e9\u4e0e\u60a8\u7684\u64cd\u4f5c\u7cfb\u7edf\u7248\u672c\u517c\u5bb9\u7684\u5b89\u88c5\u5305\uff0c\u4ee5\u907f\u514d\u6f5c\u5728\u7684\u5b89\u88c5\u95ee\u9898\u3002<\/p>\n<p><strong>\u5728\u4e0b\u8f7dPython\u65f6\uff0c\u6211\u9700\u8981\u6ce8\u610f\u54ea\u4e9b\u7cfb\u7edf\u8981\u6c42\uff1f<\/strong><br \/>\u4e0b\u8f7dPython\u4e4b\u524d\uff0c\u5efa\u8bae\u60a8\u68c0\u67e5\u60a8\u7684Mac\u7cfb\u7edf\u7248\u672c\uff0c\u56e0\u4e3a\u67d0\u4e9bPython\u7248\u672c\u5bf9\u64cd\u4f5c\u7cfb\u7edf\u6709\u7279\u5b9a\u8981\u6c42\u3002\u901a\u5e38\uff0c\u8f83\u65b0\u7684Python\u7248\u672c\u8981\u6c42macOS 10.9\u6216\u66f4\u9ad8\u7248\u672c\u3002\u540c\u65f6\uff0c\u786e\u4fdd\u60a8\u7684\u8ba1\u7b97\u673a\u6709\u8db3\u591f\u7684\u5b58\u50a8\u7a7a\u95f4\u6765\u5b8c\u6210\u5b89\u88c5\u3002<\/p>\n<p><strong>\u4e0b\u8f7d\u540e\u5982\u4f55\u5b89\u88c5Python\u4ee5\u4fbf\u987a\u5229\u8fd0\u884c\uff1f<\/strong><br \/>\u5b8c\u6210Python\u4e0b\u8f7d\u540e\uff0c\u60a8\u53ef\u4ee5\u53cc\u51fb\u4e0b\u8f7d\u7684\u5b89\u88c5\u5305\u4ee5\u542f\u52a8\u5b89\u88c5\u5411\u5bfc\u3002\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u60a8\u53ef\u4ee5\u9009\u62e9\u9ed8\u8ba4\u9009\u9879\uff0c\u4e5f\u53ef\u4ee5\u81ea\u5b9a\u4e49\u5b89\u88c5\u8def\u5f84\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165<code>python3<\/code>\u6216<code>python<\/code>\u6765\u9a8c\u8bc1Python\u662f\u5426\u6210\u529f\u5b89\u88c5\u5e76\u67e5\u770b\u7248\u672c\u4fe1\u606f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u4e0b\u8f7dMac\u7248Python\uff0c\u4f60\u9700\u8981\u8bbf\u95eePython\u7684\u5b98\u65b9\u7f51\u7ad9\u3001\u9009\u62e9\u5408\u9002\u7684Python\u7248\u672c\u3001\u4e0b\u8f7d\u5b89\u88c5\u5305\u5e76\u6309\u7167\u5b89\u88c5 [&hellip;]","protected":false},"author":3,"featured_media":954907,"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\/954902"}],"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=954902"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/954902\/revisions"}],"predecessor-version":[{"id":954908,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/954902\/revisions\/954908"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/954907"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=954902"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=954902"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=954902"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}