{"id":1096744,"date":"2025-01-08T15:04:31","date_gmt":"2025-01-08T07:04:31","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1096744.html"},"modified":"2025-01-08T15:04:35","modified_gmt":"2025-01-08T07:04:35","slug":"mac%e5%ae%89%e8%a3%85python3%e5%90%8e%e5%a6%82%e4%bd%95%e6%89%93%e5%bc%80-2","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1096744.html","title":{"rendered":"mac\u5b89\u88c5python3\u540e\u5982\u4f55\u6253\u5f00"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24211822\/d961c31a-0c2a-42b3-90db-316bf6d8b412.webp\" alt=\"mac\u5b89\u88c5python3\u540e\u5982\u4f55\u6253\u5f00\" \/><\/p>\n<p><p> <strong>\u5728Mac\u4e0a\u5b89\u88c5Python3\u540e\u5982\u4f55\u6253\u5f00\uff1f<\/strong> <strong>\u6253\u5f00\u7ec8\u7aef\u3001\u4f7f\u7528\u547d\u4ee4\u884c\u542f\u52a8\u3001\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/strong>\uff0c\u8fd9\u4e9b\u90fd\u662f\u5728Mac\u4e0a\u5b89\u88c5Python3\u540e\u6253\u5f00\u5b83\u7684\u6838\u5fc3\u6b65\u9aa4\u3002\u4ee5\u4e0b\u5c06\u8be6\u7ec6\u8bf4\u660e\u5982\u4f55\u901a\u8fc7\u8fd9\u4e9b\u6b65\u9aa4\u6765\u4f7f\u7528Python3\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u6253\u5f00\u7ec8\u7aef<\/p>\n<\/p>\n<p><p>\u5728Mac\u4e0a\uff0c\u7ec8\u7aef\uff08Terminal\uff09\u662f\u4e00\u4e2a\u975e\u5e38\u5f3a\u5927\u7684\u5de5\u5177\uff0c\u5b83\u5141\u8bb8\u4f60\u4e0e\u64cd\u4f5c\u7cfb\u7edf\u8fdb\u884c\u4ea4\u4e92\u3002\u8981\u6253\u5f00\u7ec8\u7aef\uff0c\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u201c\u5e94\u7528\u7a0b\u5e8f\u201d\uff08Applications\uff09\u6587\u4ef6\u5939\uff0c\u7136\u540e\u6253\u5f00\u201c\u5b9e\u7528\u5de5\u5177\u201d\uff08Utilities\uff09\u6587\u4ef6\u5939\uff0c\u627e\u5230\u5e76\u53cc\u51fb\u201c\u7ec8\u7aef\u201d\u3002<\/li>\n<li>\u4f60\u4e5f\u53ef\u4ee5\u4f7f\u7528\u5feb\u6377\u952e\uff0c\u6309\u4e0b<code>Cmd + \u7a7a\u683c\u952e<\/code>\uff0c\u7136\u540e\u8f93\u5165\u201c\u7ec8\u7aef\u201d\u5e76\u6309\u4e0bEnter\u952e\u3002<\/li>\n<\/ol>\n<p><p>\u5728\u7ec8\u7aef\u4e2d\uff0c\u4f60\u53ef\u4ee5\u8f93\u5165\u5404\u79cd\u547d\u4ee4\u6765\u4e0e\u64cd\u4f5c\u7cfb\u7edf\u8fdb\u884c\u4ea4\u4e92\u3002<\/p>\n<\/p>\n<p><p>\u4e8c\u3001\u4f7f\u7528\u547d\u4ee4\u884c\u542f\u52a8<\/p>\n<\/p>\n<p><p>\u5728\u7ec8\u7aef\u4e2d\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u884c\u6765\u542f\u52a8Python3\u3002\u5047\u8bbe\u4f60\u5df2\u7ecf\u5b89\u88c5\u4e86Python3\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u542f\u52a8\u5b83\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">python3<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u6253\u5f00Python3\u7684\u4ea4\u4e92\u5f0f\u89e3\u91ca\u5668\uff0c\u4f60\u53ef\u4ee5\u5728\u5176\u4e2d\u8f93\u5165Python\u4ee3\u7801\u5e76\u7acb\u5373\u770b\u5230\u7ed3\u679c\u3002\u5982\u679c\u4f60\u770b\u5230\u4ee5\u4e0b\u63d0\u793a\u7b26\uff0c\u8bf4\u660e\u4f60\u5df2\u7ecf\u6210\u529f\u542f\u52a8\u4e86Python3\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">Python 3.x.x (default, ... , ...) <\/p>\n<p>[GCC ...] on darwin<\/p>\n<p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.<\/p>\n<p>&gt;&gt;&gt;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728<code>&gt;&gt;&gt;<\/code>\u63d0\u793a\u7b26\u4e0b\uff0c\u4f60\u53ef\u4ee5\u8f93\u5165\u4efb\u4f55Python\u4ee3\u7801\u5e76\u6309\u4e0bEnter\u952e\u6765\u6267\u884c\u5b83\u3002\u4f8b\u5982\uff0c\u8f93\u5165<code>print(&quot;Hello, World!&quot;)<\/code>\u5e76\u6309\u4e0bEnter\u952e\uff0c\u4f60\u4f1a\u770b\u5230\u8f93\u51fa\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">Hello, World!<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e09\u3001\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/p>\n<\/p>\n<p><p>\u4e3a\u4e86\u65b9\u4fbf\u5730\u4f7f\u7528Python3\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u914d\u7f6e\u73af\u5883\u53d8\u91cf\uff0c\u4f7f\u5f97\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165<code>python<\/code>\u547d\u4ee4\u65f6\u9ed8\u8ba4\u4f7f\u7528Python3\u3002\u4ee5\u4e0b\u662f\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u4f60\u7684shell\u914d\u7f6e\u6587\u4ef6\uff0c\u4f8b\u5982<code>~\/.bash_profile<\/code>\u3001<code>~\/.zshrc<\/code>\u6216<code>~\/.bashrc<\/code>\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4e4b\u4e00\u6765\u6253\u5f00\u6587\u4ef6\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-sh\">nano ~\/.bash_profile<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6216\u8005<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">nano ~\/.zshrc<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li>\u5728\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-sh\">alias python=python3<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"3\">\n<li>\n<p>\u4fdd\u5b58\u6587\u4ef6\u5e76\u9000\u51fanano\u7f16\u8f91\u5668\uff08\u6309\u4e0b<code>Ctrl + X<\/code>\uff0c\u7136\u540e\u6309\u4e0b<code>Y<\/code>\u786e\u8ba4\u4fdd\u5b58\u5e76\u6309\u4e0bEnter\u952e\uff09\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p>\u91cd\u65b0\u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6\uff0c\u4f7f\u66f4\u6539\u751f\u6548\uff1a<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><pre><code class=\"language-sh\">source ~\/.bash_profile<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6216\u8005<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">source ~\/.zshrc<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u73b0\u5728\uff0c\u5f53\u4f60\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165<code>python<\/code>\u65f6\uff0c\u5b83\u5c06\u9ed8\u8ba4\u4f7f\u7528Python3\u3002<\/p>\n<\/p>\n<p><p>\u56db\u3001\u5b89\u88c5\u548c\u4f7f\u7528\u5305\u7ba1\u7406\u5de5\u5177<\/p>\n<\/p>\n<p><p>\u5b89\u88c5Python3\u540e\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u4f7f\u7528\u5404\u79cd\u7b2c\u4e09\u65b9\u5e93\u548c\u5305\u3002Python\u63d0\u4f9b\u4e86\u4e00\u4e2a\u5f3a\u5927\u7684\u5305\u7ba1\u7406\u5de5\u5177\u2014\u2014<code>pip<\/code>\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u5b83\u6765\u5b89\u88c5\u548c\u7ba1\u7406\u8fd9\u4e9b\u5305\u3002<\/p>\n<\/p>\n<p><p>\u8981\u68c0\u67e5\u662f\u5426\u5df2\u7ecf\u5b89\u88c5\u4e86<code>pip<\/code>\uff0c\u4f60\u53ef\u4ee5\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip3 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c<code>pip3<\/code>\u5df2\u7ecf\u5b89\u88c5\uff0c\u4f60\u4f1a\u770b\u5230\u7248\u672c\u4fe1\u606f\u3002\u5982\u679c\u6ca1\u6709\u5b89\u88c5\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">python3 -m ensurepip --upgrade<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528<code>pip3<\/code>\u6765\u5b89\u88c5\u4efb\u4f55Python\u5305\uff0c\u4f8b\u5982<code>requests<\/code>\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip3 install requests<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e94\u3001\u521b\u5efa\u548c\u8fd0\u884cPython\u811a\u672c<\/p>\n<\/p>\n<p><p>\u9664\u4e86\u5728\u4ea4\u4e92\u5f0f\u89e3\u91ca\u5668\u4e2d\u8fd0\u884cPython\u4ee3\u7801\uff0c\u4f60\u8fd8\u53ef\u4ee5\u521b\u5efaPython\u811a\u672c\u5e76\u8fd0\u884c\u5b83\u4eec\u3002\u4ee5\u4e0b\u662f\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u4f7f\u7528\u4f60\u559c\u6b22\u7684\u6587\u672c\u7f16\u8f91\u5668\uff08\u4f8b\u5982nano\u3001vim\u6216Visual Studio Code\uff09\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Python\u6587\u4ef6\u3002\u4f8b\u5982\uff0c\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code>hello.py<\/code>\u7684\u6587\u4ef6\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-sh\">nano hello.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li>\u5728\u6587\u4ef6\u4e2d\u8f93\u5165\u4ee5\u4e0bPython\u4ee3\u7801\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-python\">print(&quot;Hello, World!&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"3\">\n<li>\n<p>\u4fdd\u5b58\u6587\u4ef6\u5e76\u9000\u51fa\u7f16\u8f91\u5668\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p>\u5728\u7ec8\u7aef\u4e2d\uff0c\u5bfc\u822a\u5230\u5305\u542b<code>hello.py<\/code>\u6587\u4ef6\u7684\u76ee\u5f55\uff0c\u7136\u540e\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8fd0\u884c\u811a\u672c\uff1a<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><pre><code class=\"language-sh\">python3 hello.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4f60\u4f1a\u770b\u5230\u8f93\u51fa\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">Hello, World!<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u516d\u3001\u4f7f\u7528\u865a\u62df\u73af\u5883<\/p>\n<\/p>\n<p><p>\u5728\u5f00\u53d1Python\u9879\u76ee\u65f6\uff0c\u4f7f\u7528\u865a\u62df\u73af\u5883\u662f\u4e00\u4e2a\u5f88\u597d\u7684\u5b9e\u8df5\uff0c\u5b83\u53ef\u4ee5\u5e2e\u52a9\u4f60\u9694\u79bb\u9879\u76ee\u7684\u4f9d\u8d56\u5173\u7cfb\uff0c\u907f\u514d\u4e0d\u540c\u9879\u76ee\u4e4b\u95f4\u7684\u5305\u51b2\u7a81\u3002<\/p>\n<\/p>\n<p><p>\u4f60\u53ef\u4ee5\u4f7f\u7528<code>venv<\/code>\u6a21\u5757\u6765\u521b\u5efa\u865a\u62df\u73af\u5883\u3002\u4ee5\u4e0b\u662f\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u5728\u4f60\u7684\u9879\u76ee\u76ee\u5f55\u4e2d\uff0c\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u865a\u62df\u73af\u5883\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-sh\">python3 -m venv myenv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u5728\u5f53\u524d\u76ee\u5f55\u4e2d\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code>myenv<\/code>\u7684\u6587\u4ef6\u5939\uff0c\u5176\u4e2d\u5305\u542b\u865a\u62df\u73af\u5883\u7684\u6240\u6709\u6587\u4ef6\u3002<\/p>\n<\/p>\n<ol start=\"2\">\n<li>\u6fc0\u6d3b\u865a\u62df\u73af\u5883\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-sh\">source myenv\/bin\/activate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u540e\uff0c\u4f60\u4f1a\u770b\u5230\u7ec8\u7aef\u63d0\u793a\u7b26\u524d\u9762\u6709\u4e00\u4e2a<code>(myenv)<\/code>\uff0c\u8868\u793a\u865a\u62df\u73af\u5883\u5df2\u6fc0\u6d3b\u3002<\/p>\n<\/p>\n<ol start=\"3\">\n<li>\u5728\u865a\u62df\u73af\u5883\u4e2d\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528<code>pip<\/code>\u6765\u5b89\u88c5\u5305\uff0c\u8fd9\u4e9b\u5305\u53ea\u4f1a\u5728\u865a\u62df\u73af\u5883\u4e2d\u53ef\u7528\u3002\u4f8b\u5982\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-sh\">pip install requests<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"4\">\n<li>\u8981\u9000\u51fa\u865a\u62df\u73af\u5883\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-sh\">deactivate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e03\u3001\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09<\/p>\n<\/p>\n<p><p>\u867d\u7136\u7ec8\u7aef\u548c\u6587\u672c\u7f16\u8f91\u5668\u662f\u975e\u5e38\u5f3a\u5927\u7684\u5de5\u5177\uff0c\u4f46\u4f7f\u7528\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u53ef\u4ee5\u5927\u5927\u63d0\u9ad8\u4f60\u7684\u5f00\u53d1\u6548\u7387\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u6d41\u884c\u7684Python IDE\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>PyCharm<\/strong>\uff1a\u7531JetBr<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>ns\u5f00\u53d1\u7684\u4e00\u4e2a\u975e\u5e38\u5f3a\u5927\u7684Python IDE\uff0c\u63d0\u4f9b\u4e86\u8bb8\u591a\u6709\u7528\u7684\u529f\u80fd\uff0c\u5982\u4ee3\u7801\u8865\u5168\u3001\u8c03\u8bd5\u3001\u6d4b\u8bd5\u7b49\u3002\u4f60\u53ef\u4ee5\u4ece<a href=\"https:\/\/www.jetbrains.com\/pycharm\/\">\u5b98\u65b9\u9875\u9762<\/a>\u4e0b\u8f7d\u5e76\u5b89\u88c5PyCharm\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>Visual Studio Code<\/strong>\uff1a\u4e00\u4e2a\u975e\u5e38\u6d41\u884c\u7684\u5f00\u6e90\u4ee3\u7801\u7f16\u8f91\u5668\uff0c\u652f\u6301\u591a\u79cd\u7f16\u7a0b\u8bed\u8a00\uff0c\u5305\u62ecPython\u3002\u4f60\u53ef\u4ee5\u4ece<a href=\"https:\/\/code.visualstudio.com\/\">\u5b98\u65b9\u9875\u9762<\/a>\u4e0b\u8f7d\u5e76\u5b89\u88c5Visual Studio Code\uff0c\u5e76\u901a\u8fc7\u5b89\u88c5Python\u6269\u5c55\u6765\u83b7\u5f97Python\u652f\u6301\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>Jupyter Notebook<\/strong>\uff1a\u4e00\u4e2a\u975e\u5e38\u6d41\u884c\u7684\u4ea4\u4e92\u5f0f\u8ba1\u7b97\u73af\u5883\uff0c\u975e\u5e38\u9002\u5408\u6570\u636e\u79d1\u5b66\u548c<a href=\"https:\/\/docs.pingcode.com\/ask\/59192.html\" target=\"_blank\">\u673a\u5668\u5b66\u4e60<\/a>\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528<code>pip<\/code>\u6765\u5b89\u88c5Jupyter Notebook\uff1a<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><pre><code class=\"language-sh\">pip install notebook<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8Jupyter Notebook\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">jupyter notebook<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u603b\u7ed3<\/p>\n<\/p>\n<p><p>\u5728Mac\u4e0a\u5b89\u88c5Python3\u540e\uff0c\u6253\u5f00\u548c\u4f7f\u7528\u5b83\u7684\u6b65\u9aa4\u5305\u62ec\uff1a<strong>\u6253\u5f00\u7ec8\u7aef\u3001\u4f7f\u7528\u547d\u4ee4\u884c\u542f\u52a8\u3001\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u3001\u5b89\u88c5\u548c\u4f7f\u7528\u5305\u7ba1\u7406\u5de5\u5177\u3001\u521b\u5efa\u548c\u8fd0\u884cPython\u811a\u672c\u3001\u4f7f\u7528\u865a\u62df\u73af\u5883\u3001\u4f7f\u7528\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09<\/strong>\u3002\u8fd9\u4e9b\u6b65\u9aa4\u5c06\u5e2e\u52a9\u4f60\u5145\u5206\u5229\u7528Python3\u8fdb\u884c\u5f00\u53d1\u548c\u5b66\u4e60\u3002\u5e0c\u671b\u8fd9\u7bc7\u6587\u7ae0\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff0c\u795d\u4f60\u5728Python\u7684\u4e16\u754c\u4e2d\u53d6\u5f97\u6210\u529f\uff01<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Mac\u4e0a\u786e\u8ba4Python3\u662f\u5426\u5df2\u6210\u529f\u5b89\u88c5\uff1f<\/strong><br \/>\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165<code>python3 --version<\/code>\uff0c\u5982\u679c\u6210\u529f\u5b89\u88c5\uff0c\u7cfb\u7edf\u5c06\u8fd4\u56dePython3\u7684\u7248\u672c\u53f7\u3002\u5982\u679c\u6ca1\u6709\u5b89\u88c5\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u91cd\u65b0\u8fdb\u884c\u5b89\u88c5\uff0c\u786e\u4fdd\u6309\u7167\u5b98\u65b9\u6587\u6863\u7684\u6b65\u9aa4\u8fdb\u884c\u3002<\/p>\n<p><strong>\u5728Mac\u4e0a\u5b89\u88c5Python3\u540e\uff0c\u5982\u4f55\u627e\u5230Python\u7684\u5b89\u88c5\u8def\u5f84\uff1f<\/strong><br \/>\u53ef\u4ee5\u901a\u8fc7\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165<code>which python3<\/code>\u6765\u67e5\u627ePython3\u7684\u5b89\u88c5\u8def\u5f84\u3002\u8fd9\u5c06\u663e\u793aPython3\u7684\u53ef\u6267\u884c\u6587\u4ef6\u6240\u5728\u7684\u5b8c\u6574\u8def\u5f84\uff0c\u60a8\u53ef\u4ee5\u6839\u636e\u8be5\u8def\u5f84\u8fdb\u884c\u8fdb\u4e00\u6b65\u7684\u914d\u7f6e\u6216\u4f7f\u7528\u3002<\/p>\n<p><strong>\u5728Mac\u4e0a\u6253\u5f00Python3\u540e\uff0c\u5982\u4f55\u4f7f\u7528\u5b83\u8fdb\u884c\u7f16\u7a0b\uff1f<\/strong><br \/>\u6253\u5f00\u7ec8\u7aef\u540e\uff0c\u8f93\u5165<code>python3<\/code>\u547d\u4ee4\u5373\u53ef\u8fdb\u5165Python\u7684\u4ea4\u4e92\u5f0f\u547d\u4ee4\u884c\u754c\u9762\u3002\u5728\u8fd9\u91cc\uff0c\u60a8\u53ef\u4ee5\u76f4\u63a5\u8f93\u5165Python\u4ee3\u7801\u5e76\u7acb\u5373\u6267\u884c\u3002\u5982\u679c\u5e0c\u671b\u7f16\u5199\u590d\u6742\u7684\u7a0b\u5e8f\uff0c\u53ef\u4ee5\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\uff08\u5982Visual Studio Code\u6216Sublime Text\uff09\u7f16\u5199.py\u6587\u4ef6\uff0c\u7136\u540e\u5728\u7ec8\u7aef\u4e2d\u4f7f\u7528<code>python3 your_script.py<\/code>\u547d\u4ee4\u8fd0\u884c\u811a\u672c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Mac\u4e0a\u5b89\u88c5Python3\u540e\u5982\u4f55\u6253\u5f00\uff1f \u6253\u5f00\u7ec8\u7aef\u3001\u4f7f\u7528\u547d\u4ee4\u884c\u542f\u52a8\u3001\u914d\u7f6e\u73af\u5883\u53d8\u91cf\uff0c\u8fd9\u4e9b\u90fd\u662f\u5728Mac\u4e0a\u5b89\u88c5Pyt [&hellip;]","protected":false},"author":3,"featured_media":1096757,"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\/1096744"}],"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=1096744"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1096744\/revisions"}],"predecessor-version":[{"id":1096760,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1096744\/revisions\/1096760"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1096757"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1096744"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1096744"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1096744"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}