{"id":939200,"date":"2024-12-26T20:29:38","date_gmt":"2024-12-26T12:29:38","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/939200.html"},"modified":"2024-12-26T20:29:40","modified_gmt":"2024-12-26T12:29:40","slug":"mac%e5%a6%82%e4%bd%95%e5%ba%94%e7%94%a8python","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/939200.html","title":{"rendered":"mac\u5982\u4f55\u5e94\u7528python"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25074332\/2345705d-edf7-4dac-a671-4d6a325996b9.webp\" alt=\"mac\u5982\u4f55\u5e94\u7528python\" \/><\/p>\n<p><p> <strong>\u5728Mac\u4e0a\u5e94\u7528Python\u7684\u65b9\u5f0f\u5305\u62ec\uff1a\u4f7f\u7528\u7ec8\u7aef\u8fdb\u884c\u547d\u4ee4\u884c\u64cd\u4f5c\u3001\u901a\u8fc7\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u8fdb\u884c\u5f00\u53d1\u3001\u4f7f\u7528Jupyter Notebook\u8fdb\u884c\u4ea4\u4e92\u5f0f\u7f16\u7a0b\u3001\u5229\u7528Python\u5e93\u8fdb\u884c\u6570\u636e\u5206\u6790\u548c<a href=\"https:\/\/docs.pingcode.com\/ask\/59192.html\" target=\"_blank\">\u673a\u5668\u5b66\u4e60<\/a>\u3002<\/strong>\u5176\u4e2d\uff0c\u4f7f\u7528\u7ec8\u7aef\u8fdb\u884c\u547d\u4ee4\u884c\u64cd\u4f5c\u662f\u6700\u57fa\u672c\u4e5f\u662f\u6700\u5e38\u7528\u7684\u65b9\u5f0f\uff0c\u5b83\u5141\u8bb8\u7528\u6237\u76f4\u63a5\u8fd0\u884cPython\u811a\u672c\u5e76\u8fdb\u884c\u8c03\u8bd5\u3002\u4e0b\u9762\u6211\u4eec\u5c06\u8be6\u7ec6\u63a2\u8ba8\u8fd9\u4e00\u70b9\u3002<\/p>\n<\/p>\n<p><p>\u5728Mac\u4e0a\uff0cPython\u901a\u5e38\u9884\u88c5\u5728\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u7ec8\u7aef\uff08Terminal\uff09\u8bbf\u95ee\u3002\u5728\u7ec8\u7aef\u4e2d\uff0c\u53ef\u4ee5\u8f93\u5165<code>python<\/code>\u6216<code>python3<\/code>\u547d\u4ee4\u6765\u542f\u52a8Python\u89e3\u91ca\u5668\uff0c\u7136\u540e\u8f93\u5165Python\u4ee3\u7801\u8fdb\u884c\u6d4b\u8bd5\u548c\u8c03\u8bd5\u3002\u901a\u8fc7\u7ec8\u7aef\uff0c\u7528\u6237\u53ef\u4ee5\u8f7b\u677e\u5730\u7ba1\u7406Python\u73af\u5883\u3001\u5b89\u88c5\u548c\u7ba1\u7406Python\u5e93\u3001\u4ee5\u53ca\u8fd0\u884cPython\u811a\u672c\u3002\u4e3a\u4e86\u8fdb\u4e00\u6b65\u63d0\u5347\u5f00\u53d1\u6548\u7387\uff0c\u7528\u6237\u53ef\u4ee5\u9009\u62e9\u5b89\u88c5\u548c\u4f7f\u7528\u865a\u62df\u73af\u5883\u5de5\u5177\u5982<code>virtualenv<\/code>\u6216<code>conda<\/code>\uff0c\u4ee5\u4fbf\u5728\u4e0d\u540c\u7684\u9879\u76ee\u4e2d\u9694\u79bb\u548c\u7ba1\u7406\u4e0d\u540c\u7684Python\u73af\u5883\u548c\u4f9d\u8d56\u3002<\/p>\n<\/p>\n<p><p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u63a2\u8ba8\u5728Mac\u4e0a\u5982\u4f55\u9ad8\u6548\u5730\u5e94\u7528Python\uff0c\u6db5\u76d6\u4ece\u57fa\u7840\u7684\u5b89\u88c5\u5230\u9ad8\u7ea7\u7684\u6570\u636e\u5206\u6790\u548c\u673a\u5668\u5b66\u4e60\u5e94\u7528\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u5b89\u88c5\u548c\u914d\u7f6ePython\u73af\u5883<\/h3>\n<\/p>\n<p><p>\u5728Mac\u4e0a\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4f1a\u9884\u88c5Python 2.x\u7248\u672c\uff0c\u4f46\u4e3a\u4e86\u83b7\u5f97\u66f4\u597d\u7684\u6027\u80fd\u548c\u529f\u80fd\uff0c\u5efa\u8bae\u4f7f\u7528Python 3.x\u7248\u672c\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u5b89\u88c5\u548c\u914d\u7f6ePython 3\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4f7f\u7528Homebrew\u5b89\u88c5Python 3<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>Homebrew\u662fMac\u4e0a\u7684\u4e00\u4e2a\u6d41\u884c\u7684\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668\uff0c\u53ef\u4ee5\u901a\u8fc7\u7ec8\u7aef\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\uff1a\n<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<\/li>\n<li>\u5b89\u88c5Python 3\uff1a\n<pre><code class=\"language-bash\">brew install python<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u9a8c\u8bc1\u5b89\u88c5<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u9a8c\u8bc1Python 3\u7684\u5b89\u88c5\uff1a\n<pre><code class=\"language-bash\">python3 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u8fd9\u5c06\u663e\u793a\u5df2\u5b89\u88c5\u7684Python\u7248\u672c\u53f7\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5pip\u548c\u865a\u62df\u73af\u5883<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li><code>pip<\/code>\u662fPython\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u901a\u5e38\u4e0ePython\u4e00\u8d77\u5b89\u88c5\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\u865a\u62df\u73af\u5883\u5de5\u5177\uff1a\n<pre><code class=\"language-bash\">python3 -m pip install --user virtualenv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><h3>\u4e8c\u3001\u4f7f\u7528\u7ec8\u7aef\u8fdb\u884cPython\u5f00\u53d1<\/h3>\n<\/p>\n<ol>\n<li>\n<p><strong>\u8fd0\u884cPython\u811a\u672c<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u53ef\u4ee5\u901a\u8fc7\u7ec8\u7aef\u8fd0\u884cPython\u811a\u672c\u3002\u9996\u5148\uff0c\u521b\u5efa\u4e00\u4e2aPython\u6587\u4ef6\uff08\u5982<code>script.py<\/code>\uff09\uff0c\u7136\u540e\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u8fd0\u884c\u8be5\u811a\u672c\uff1a\n<pre><code class=\"language-bash\">python3 script.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528\u4ea4\u4e92\u5f0f\u89e3\u91ca\u5668<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165<code>python3<\/code>\uff0c\u542f\u52a8Python\u4ea4\u4e92\u5f0f\u89e3\u91ca\u5668\uff0c\u53ef\u4ee5\u76f4\u63a5\u8f93\u5165Python\u4ee3\u7801\u5e76\u7acb\u5373\u67e5\u770b\u7ed3\u679c\u3002<\/li>\n<li>\u8fd9\u5bf9\u4e8e\u5feb\u901f\u6d4b\u8bd5\u4ee3\u7801\u7247\u6bb5\u548c\u8c03\u8bd5\u975e\u5e38\u6709\u7528\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u7ba1\u7406Python\u5305<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u4f7f\u7528<code>pip<\/code>\u53ef\u4ee5\u5b89\u88c5\u3001\u66f4\u65b0\u548c\u5378\u8f7dPython\u5305\u3002\u4f8b\u5982\uff0c\u5b89\u88c5<code>numpy<\/code>\u5e93\uff1a\n<pre><code class=\"language-bash\">pip3 install numpy<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><h3>\u4e09\u3001\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u9009\u62e9<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528IDE\u53ef\u4ee5\u5927\u5927\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u3002\u4ee5\u4e0b\u662fMac\u4e0a\u51e0\u79cd\u6d41\u884c\u7684Python IDE\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>PyCharm<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u662fJetBr<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>ns\u516c\u53f8\u5f00\u53d1\u7684\u4e00\u6b3e\u529f\u80fd\u5f3a\u5927\u7684Python IDE\uff0c\u652f\u6301\u4ee3\u7801\u81ea\u52a8\u8865\u5168\u3001\u8c03\u8bd5\u3001\u6d4b\u8bd5\u548c\u7248\u672c\u63a7\u5236\u7b49\u529f\u80fd\u3002<\/li>\n<li>\u53ef\u4ee5\u4eceJetBrains\u5b98\u7f51\u4e0b\u8f7d\u5e76\u5b89\u88c5PyCharm\uff0c\u5e76\u6839\u636e\u9879\u76ee\u9700\u6c42\u9009\u62e9\u793e\u533a\u7248\u6216\u4e13\u4e1a\u7248\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>Visual Studio Code<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u662f\u5fae\u8f6f\u63a8\u51fa\u7684\u4e00\u6b3e\u8f7b\u91cf\u7ea7\u4ee3\u7801\u7f16\u8f91\u5668\uff0c\u652f\u6301Python\u6269\u5c55\u3002\u53ef\u4ee5\u901a\u8fc7Mac App Store\u6216\u5b98\u7f51\u4e0b\u8f7d\u5e76\u5b89\u88c5\u3002<\/li>\n<li>\u5b89\u88c5Python\u6269\u5c55\u540e\uff0cVisual Studio Code\u53ef\u4ee5\u63d0\u4f9b\u4ee3\u7801\u9ad8\u4eae\u3001\u81ea\u52a8\u8865\u5168\u548c\u8c03\u8bd5\u529f\u80fd\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>Jupyter Notebook<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u662f\u4e00\u4e2a\u4ea4\u4e92\u5f0f\u7f16\u7a0b\u73af\u5883\uff0c\u7279\u522b\u9002\u5408\u6570\u636e\u5206\u6790\u548c\u673a\u5668\u5b66\u4e60\u9879\u76ee\u3002\u53ef\u4ee5\u901a\u8fc7<code>pip<\/code>\u5b89\u88c5\uff1a\n<pre><code class=\"language-bash\">pip3 install jupyter<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u542f\u52a8Jupyter Notebook\uff1a\n<pre><code class=\"language-bash\">jupyter notebook<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u8fd9\u5c06\u6253\u5f00\u4e00\u4e2a\u7f51\u9875\u754c\u9762\uff0c\u53ef\u4ee5\u5728\u5176\u4e2d\u521b\u5efa\u548c\u7ba1\u7406Notebooks\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><h3>\u56db\u3001Python\u5e93\u7684\u4f7f\u7528<\/h3>\n<\/p>\n<p><p>Python\u6709\u5927\u91cf\u7684\u5e93\u53ef\u4f9b\u4f7f\u7528\uff0c\u6db5\u76d6\u4e86\u6570\u636e\u5206\u6790\u3001\u673a\u5668\u5b66\u4e60\u3001\u7f51\u7edc\u5f00\u53d1\u7b49\u591a\u4e2a\u9886\u57df\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u7528\u5e93\u7684\u4ecb\u7ecd\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6570\u636e\u5206\u6790\u5e93<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li><strong>NumPy<\/strong>\uff1a\u7528\u4e8e\u79d1\u5b66\u8ba1\u7b97\u7684\u57fa\u7840\u5e93\uff0c\u63d0\u4f9b\u591a\u7ef4\u6570\u7ec4\u5bf9\u8c61\u548c\u76f8\u5173\u64cd\u4f5c\u3002<\/li>\n<li><strong>Pandas<\/strong>\uff1a\u7528\u4e8e\u6570\u636e\u64cd\u4f5c\u548c\u5206\u6790\uff0c\u63d0\u4f9b\u6570\u636e\u7ed3\u6784\u548c\u6570\u636e\u5206\u6790\u5de5\u5177\u3002<\/li>\n<li><strong>Matplotlib<\/strong>\uff1a\u7528\u4e8e\u6570\u636e\u53ef\u89c6\u5316\u7684\u7ed8\u56fe\u5e93\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u673a\u5668\u5b66\u4e60\u5e93<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li><strong>Scikit-learn<\/strong>\uff1a\u63d0\u4f9b\u7b80\u5355\u9ad8\u6548\u7684\u6570\u636e\u6316\u6398\u548c\u6570\u636e\u5206\u6790\u5de5\u5177\u3002<\/li>\n<li><strong>TensorFlow\u548cKeras<\/strong>\uff1a\u7528\u4e8e\u6df1\u5ea6\u5b66\u4e60\u7684\u6846\u67b6\uff0c\u652f\u6301\u6784\u5efa\u548c\u8bad\u7ec3\u795e\u7ecf\u7f51\u7edc\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u7f51\u7edc\u5f00\u53d1\u5e93<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li><strong>Django\u548cFlask<\/strong>\uff1a\u7528\u4e8e\u5f00\u53d1Web\u5e94\u7528\u7684\u6846\u67b6\uff0c\u63d0\u4f9b\u8def\u7531\u3001\u6a21\u677f\u548c\u6570\u636e\u5e93\u64cd\u4f5c\u7b49\u529f\u80fd\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><h3>\u4e94\u3001<a href=\"https:\/\/docs.pingcode.com\/blog\/project-management\/23316.html\" target=\"_blank\">\u9879\u76ee\u7ba1\u7406<\/a>\u548c\u7248\u672c\u63a7\u5236<\/h3>\n<\/p>\n<p><p>\u826f\u597d\u7684\u9879\u76ee\u7ba1\u7406\u548c\u7248\u672c\u63a7\u5236\u662f\u6210\u529f\u7684Python\u5f00\u53d1\u7684\u5173\u952e\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u63a8\u8350\u7684\u5de5\u5177\u548c\u5b9e\u8df5\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>Git\u548cGitHub<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>Git\u662f\u4e00\u4e2a\u5206\u5e03\u5f0f\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff0c\u53ef\u4ee5\u901a\u8fc7Homebrew\u5b89\u88c5\uff1a\n<pre><code class=\"language-bash\">brew install git<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>GitHub\u662f\u4e00\u4e2a\u57fa\u4e8eGit\u7684\u4ee3\u7801\u6258\u7ba1\u5e73\u53f0\uff0c\u652f\u6301\u534f\u4f5c\u5f00\u53d1\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528\u865a\u62df\u73af\u5883<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u5728\u4e0d\u540c\u7684\u9879\u76ee\u4e2d\u4f7f\u7528\u865a\u62df\u73af\u5883\u53ef\u4ee5\u907f\u514d\u5e93\u7248\u672c\u51b2\u7a81\u3002\u521b\u5efa\u865a\u62df\u73af\u5883\uff1a\n<pre><code class=\"language-bash\">python3 -m venv myenv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u6fc0\u6d3b\u865a\u62df\u73af\u5883\uff1a\n<pre><code class=\"language-bash\">source myenv\/bin\/activate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u9879\u76ee\u7ed3\u6784\u548c\u4f9d\u8d56\u7ba1\u7406<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u4f7f\u7528<code>requirements.txt<\/code>\u6587\u4ef6\u7ba1\u7406\u9879\u76ee\u4f9d\u8d56\u3002\u751f\u6210\u4f9d\u8d56\u5217\u8868\uff1a\n<pre><code class=\"language-bash\">pip freeze &gt; requirements.txt<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\u4f9d\u8d56\uff1a\n<pre><code class=\"language-bash\">pip install -r requirements.txt<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><p>\u7efc\u4e0a\u6240\u8ff0\uff0cMac\u4e0a\u5e94\u7528Python\u7684\u65b9\u6cd5\u591a\u79cd\u591a\u6837\uff0c\u4ece\u57fa\u672c\u7684\u547d\u4ee4\u884c\u64cd\u4f5c\u5230\u9ad8\u7ea7\u7684IDE\u548c\u5e93\u4f7f\u7528\uff0c\u65e0\u8bba\u662f\u65b0\u624b\u8fd8\u662f\u7ecf\u9a8c\u4e30\u5bcc\u7684\u5f00\u53d1\u8005\u90fd\u80fd\u627e\u5230\u9002\u5408\u81ea\u5df1\u7684\u5de5\u5177\u548c\u65b9\u6cd5\u3002\u901a\u8fc7\u638c\u63e1\u8fd9\u4e9b\u6280\u80fd\uff0c\u7528\u6237\u53ef\u4ee5\u5728Mac\u4e0a\u9ad8\u6548\u5730\u8fdb\u884cPython\u5f00\u53d1\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5728Mac\u4e0a\u5982\u4f55\u5b89\u88c5Python\uff1f<\/strong><br \/>\u5728Mac\u4e0a\u5b89\u88c5Python\u975e\u5e38\u7b80\u5355\u3002\u53ef\u4ee5\u901a\u8fc7\u8bbf\u95eePython\u7684\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u6700\u65b0\u7248\u672c\u7684\u5b89\u88c5\u5305\uff0c\u6216\u4f7f\u7528\u5305\u7ba1\u7406\u5de5\u5177Homebrew\u6765\u5b89\u88c5\u3002\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165<code>brew install python<\/code>\uff0cHomebrew\u4f1a\u81ea\u52a8\u5904\u7406Python\u53ca\u5176\u4f9d\u8d56\u9879\u7684\u5b89\u88c5\u8fc7\u7a0b\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165<code>python3 --version<\/code>\u6765\u786e\u8ba4\u5b89\u88c5\u662f\u5426\u6210\u529f\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728Mac\u4e0a\u8fd0\u884cPython\u811a\u672c\uff1f<\/strong><br \/>\u8981\u5728Mac\u4e0a\u8fd0\u884cPython\u811a\u672c\uff0c\u9996\u5148\u9700\u8981\u786e\u4fdd\u4f60\u5df2\u7ecf\u5b89\u88c5\u4e86Python\u3002\u5728\u7ec8\u7aef\u4e2d\uff0c\u5bfc\u822a\u5230\u5b58\u653ePython\u811a\u672c\u7684\u6587\u4ef6\u5939\uff0c\u4f7f\u7528<code>cd<\/code>\u547d\u4ee4\u3002\u4f8b\u5982\uff0c\u82e5\u4f60\u7684\u6587\u4ef6\u5728\u684c\u9762\u4e0a\uff0c\u8f93\u5165<code>cd ~\/Desktop<\/code>\u3002\u63a5\u7740\uff0c\u4f7f\u7528\u547d\u4ee4<code>python3 your_script.py<\/code>\u8fd0\u884c\u4f60\u7684Python\u811a\u672c\uff0c\u5176\u4e2d<code>your_script.py<\/code>\u662f\u4f60\u7684\u811a\u672c\u6587\u4ef6\u540d\u3002<\/p>\n<p><strong>Mac\u4e0a\u5982\u4f55\u914d\u7f6ePython\u5f00\u53d1\u73af\u5883\uff1f<\/strong><br \/>\u914d\u7f6ePython\u5f00\u53d1\u73af\u5883\u53ef\u4ee5\u4f7f\u7528\u591a\u79cd\u5de5\u5177\u548c\u7f16\u8f91\u5668\u3002\u5e38\u89c1\u7684\u9009\u62e9\u5305\u62ecPyCharm\u3001VS Code\u548cSublime Text\u3002\u8fd9\u4e9b\u5de5\u5177\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u529f\u80fd\uff0c\u6bd4\u5982\u4ee3\u7801\u8865\u5168\u3001\u8c03\u8bd5\u5de5\u5177\u548c\u7248\u672c\u63a7\u5236\u96c6\u6210\u3002\u5b89\u88c5\u5b8c\u6240\u9700\u7684\u7f16\u8f91\u5668\u540e\uff0c\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u9879\u76ee\uff0c\u5e76\u914d\u7f6e\u865a\u62df\u73af\u5883\u4ee5\u7ba1\u7406\u4f9d\u8d56\u5305\uff0c\u786e\u4fdd\u4e0d\u540c\u9879\u76ee\u4e4b\u95f4\u7684\u5e93\u4e0d\u53d1\u751f\u51b2\u7a81\u3002\u4f7f\u7528\u547d\u4ee4<code>python3 -m venv myenv<\/code>\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code>myenv<\/code>\u7684\u865a\u62df\u73af\u5883\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Mac\u4e0a\u5e94\u7528Python\u7684\u65b9\u5f0f\u5305\u62ec\uff1a\u4f7f\u7528\u7ec8\u7aef\u8fdb\u884c\u547d\u4ee4\u884c\u64cd\u4f5c\u3001\u901a\u8fc7\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u8fdb\u884c\u5f00\u53d1\u3001\u4f7f\u7528Jupy [&hellip;]","protected":false},"author":3,"featured_media":939202,"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\/939200"}],"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=939200"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/939200\/revisions"}],"predecessor-version":[{"id":939203,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/939200\/revisions\/939203"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/939202"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=939200"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=939200"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=939200"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}