{"id":1127348,"date":"2025-01-08T20:09:32","date_gmt":"2025-01-08T12:09:32","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1127348.html"},"modified":"2025-01-08T20:09:34","modified_gmt":"2025-01-08T12:09:34","slug":"%e5%91%bd%e4%bb%a4%e8%a1%8c-%e5%a6%82%e4%bd%95%e8%bf%90%e8%a1%8cpython%e8%84%9a%e6%9c%ac%e6%96%87%e4%bb%b6%e8%b7%af%e5%be%84","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1127348.html","title":{"rendered":"\u547d\u4ee4\u884c \u5982\u4f55\u8fd0\u884cpython\u811a\u672c\u6587\u4ef6\u8def\u5f84"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25094407\/7f3c475d-ebea-4621-8235-49fa0e3f22f0.webp\" alt=\"\u547d\u4ee4\u884c \u5982\u4f55\u8fd0\u884cpython\u811a\u672c\u6587\u4ef6\u8def\u5f84\" \/><\/p>\n<p><p> <strong>\u547d\u4ee4\u884c\u8fd0\u884cPython\u811a\u672c\u6587\u4ef6\u8def\u5f84\u7684\u6b65\u9aa4<\/strong>\uff1a<strong>\u5b89\u88c5Python\u3001\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3001\u7f16\u5199Python\u811a\u672c\u3001\u4f7f\u7528\u547d\u4ee4\u884c\u8fd0\u884c\u811a\u672c<\/strong>\u3002\u4ee5\u4e0b\u662f\u5bf9\u201c\u5b89\u88c5Python\u201d\u7684\u8be6\u7ec6\u63cf\u8ff0\uff1a<\/p>\n<\/p>\n<p><p><strong>\u5b89\u88c5Python<\/strong>\uff1a\u8981\u5728\u547d\u4ee4\u884c\u4e2d\u8fd0\u884cPython\u811a\u672c\uff0c\u9996\u5148\u9700\u8981\u5b89\u88c5Python\u89e3\u91ca\u5668\u3002\u60a8\u53ef\u4ee5\u4ecePython\u7684\u5b98\u65b9\u7f51\u7ad9\uff08python.org\uff09\u4e0b\u8f7d\u6700\u65b0\u7248\u672c\u7684Python\u5b89\u88c5\u5305\u5e76\u8fdb\u884c\u5b89\u88c5\u3002\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u8bf7\u786e\u4fdd\u52fe\u9009\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u4ee5\u4fbf\u5728\u547d\u4ee4\u884c\u4e2d\u53ef\u4ee5\u76f4\u63a5\u8c03\u7528Python\u89e3\u91ca\u5668\u3002<\/p>\n<\/p>\n<hr>\n<p><h2>\u4e00\u3001\u5b89\u88c5Python<\/h2>\n<\/p>\n<p><p>\u5728\u8fd0\u884cPython\u811a\u672c\u4e4b\u524d\uff0c\u60a8\u5fc5\u987b\u786e\u4fdd\u7cfb\u7edf\u4e2d\u5df2\u7ecf\u5b89\u88c5\u4e86Python\u3002Python\u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u7f16\u7a0b\u8bed\u8a00\uff0c\u60a8\u53ef\u4ee5\u4ecePython\u7684\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u6700\u65b0\u7248\u672c\u3002\u5b89\u88c5\u8fc7\u7a0b\u975e\u5e38\u7b80\u5355\uff0c\u901a\u5e38\u53ea\u9700\u6309\u7167\u5b89\u88c5\u5411\u5bfc\u7684\u63d0\u793a\u8fdb\u884c\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<p><h3>1\u3001\u4e0b\u8f7dPython\u5b89\u88c5\u5305<\/h3>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u8bbf\u95eePython\u7684\u5b98\u65b9\u7f51\u7ad9\uff08<a href=\"https:\/\/www.python.org\/%EF%BC%89%EF%BC%8C%E7%84%B6%E5%90%8E%E5%AF%BC%E8%88%AA%E5%88%B0%E2%80%9CDownloads%E2%80%9D%E9%A1%B5%E9%9D%A2%E3%80%82%E5%9C%A8%E6%AD%A4%E9%A1%B5%E9%9D%A2%E4%B8%AD%EF%BC%8C%E6%82%A8%E5%8F%AF%E4%BB%A5%E7%9C%8B%E5%88%B0%E9%80%82%E7%94%A8%E4%BA%8E%E4%B8%8D%E5%90%8C%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E7%9A%84Python%E5%AE%89%E8%A3%85%E5%8C%85%E3%80%82%E9%80%89%E6%8B%A9%E9%80%82%E5%90%88%E6%82%A8%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E7%9A%84%E7%89%88%E6%9C%AC%E5%B9%B6%E4%B8%8B%E8%BD%BD%E3%80%82\">https:\/\/www.python.org\/\uff09\uff0c\u7136\u540e\u5bfc\u822a\u5230\u201cDownloads\u201d\u9875\u9762\u3002\u5728\u6b64\u9875\u9762\u4e2d\uff0c\u60a8\u53ef\u4ee5\u770b\u5230\u9002\u7528\u4e8e\u4e0d\u540c\u64cd\u4f5c\u7cfb\u7edf\u7684Python\u5b89\u88c5\u5305\u3002\u9009\u62e9\u9002\u5408\u60a8\u64cd\u4f5c\u7cfb\u7edf\u7684\u7248\u672c\u5e76\u4e0b\u8f7d\u3002<\/a><\/p>\n<\/p>\n<p><h3>2\u3001\u5b89\u88c5Python<\/h3>\n<\/p>\n<p><p>\u8fd0\u884c\u4e0b\u8f7d\u7684\u5b89\u88c5\u5305\uff0c\u5b89\u88c5\u5411\u5bfc\u5c06\u5f15\u5bfc\u60a8\u5b8c\u6210\u5b89\u88c5\u8fc7\u7a0b\u3002\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u6709\u4e24\u4e2a\u91cd\u8981\u6b65\u9aa4\u9700\u8981\u6ce8\u610f\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u52fe\u9009\u201cAdd Python to PATH\u201d\u9009\u9879\uff1a\u8fd9\u5c06\u81ea\u52a8\u5c06Python\u6dfb\u52a0\u5230\u7cfb\u7edf\u7684\u73af\u5883\u53d8\u91cf\u4e2d\uff0c\u4f7f\u60a8\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e2d\u76f4\u63a5\u8c03\u7528Python\u3002<\/li>\n<li>\u9009\u62e9\u201cCustomize installation\u201d\u9009\u9879\uff1a\u5982\u679c\u60a8\u9700\u8981\u5b89\u88c5\u5176\u4ed6\u7ec4\u4ef6\u6216\u66f4\u6539\u5b89\u88c5\u8def\u5f84\uff0c\u53ef\u4ee5\u9009\u62e9\u6b64\u9009\u9879\u3002<\/li>\n<\/ul>\n<p><h3>3\u3001\u9a8c\u8bc1\u5b89\u88c5<\/h3>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6253\u5f00\u547d\u4ee4\u884c\uff08Windows\u7528\u6237\u53ef\u4ee5\u4f7f\u7528cmd\u6216PowerShell\uff0cMac\u548cLinux\u7528\u6237\u53ef\u4ee5\u4f7f\u7528\u7ec8\u7aef\uff09\u3002\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u9a8c\u8bc1\u5b89\u88c5\u662f\u5426\u6210\u529f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">python --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u5b89\u88c5\u6210\u529f\uff0c\u60a8\u5c06\u770b\u5230Python\u7684\u7248\u672c\u53f7\u3002\u5982\u679c\u672a\u6210\u529f\u5b89\u88c5\uff0c\u8bf7\u91cd\u65b0\u68c0\u67e5\u5b89\u88c5\u6b65\u9aa4\u5e76\u786e\u4fdd\u8def\u5f84\u8bbe\u7f6e\u6b63\u786e\u3002<\/p>\n<\/p>\n<hr>\n<p><h2>\u4e8c\u3001\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<\/h2>\n<\/p>\n<p><p>\u73af\u5883\u53d8\u91cf\u662f\u64cd\u4f5c\u7cfb\u7edf\u7528\u6765\u6307\u5b9a\u64cd\u4f5c\u7cfb\u7edf\u73af\u5883\u7684\u4e00\u4e9b\u53d8\u91cf\u3002\u8bbe\u7f6e\u597d\u73af\u5883\u53d8\u91cf\uff0c\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e2d\u76f4\u63a5\u8c03\u7528Python\u4ee5\u53ca\u5176\u4ed6\u547d\u4ee4\u3002\u4ee5\u4e0b\u662f\u5982\u4f55\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u7684\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><h3>1\u3001Windows\u7cfb\u7edf<\/h3>\n<\/p>\n<p><p>\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u6765\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u53f3\u952e\u70b9\u51fb\u201c\u6b64\u7535\u8111\u201d\u6216\u8005\u201c\u6211\u7684\u7535\u8111\u201d\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d\u3002<\/li>\n<li>\u9009\u62e9\u201c\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e\u201d\uff0c\u7136\u540e\u70b9\u51fb\u201c\u73af\u5883\u53d8\u91cf\u201d\u6309\u94ae\u3002<\/li>\n<li>\u5728\u201c\u7cfb\u7edf\u53d8\u91cf\u201d\u90e8\u5206\uff0c\u627e\u5230\u540d\u4e3a\u201cPath\u201d\u7684\u53d8\u91cf\uff0c\u5e76\u9009\u62e9\u201c\u7f16\u8f91\u201d\u3002<\/li>\n<li>\u5728\u201c\u7f16\u8f91\u73af\u5883\u53d8\u91cf\u201d\u7a97\u53e3\u4e2d\uff0c\u70b9\u51fb\u201c\u65b0\u5efa\u201d\uff0c\u7136\u540e\u8f93\u5165Python\u7684\u5b89\u88c5\u8def\u5f84\uff08\u4f8b\u5982\uff1aC:\\Python39\\\uff09\u3002<\/li>\n<li>\u70b9\u51fb\u201c\u786e\u5b9a\u201d\u4fdd\u5b58\u66f4\u6539\u3002<\/li>\n<\/ol>\n<p><h3>2\u3001Mac\u548cLinux\u7cfb\u7edf<\/h3>\n<\/p>\n<p><p>\u5728Mac\u548cLinux\u7cfb\u7edf\u4e2d\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u7f16\u8f91<code>.bashrc<\/code>\u6216<code>.bash_profile<\/code>\u6587\u4ef6\u6765\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u7ec8\u7aef\u3002<\/li>\n<li>\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00<code>.bashrc<\/code>\u6216<code>.bash_profile<\/code>\u6587\u4ef6\uff0c\u4f8b\u5982\uff1a<code>nano ~\/.bashrc<\/code>\u3002<\/li>\n<li>\u5728\u6587\u4ef6\u672b\u5c3e\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-sh\">export PATH=&quot;\/usr\/local\/bin\/python3:$PATH&quot;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8bf7\u5c06<code>\/usr\/local\/bin\/python3<\/code>\u66ff\u6362\u4e3aPython\u7684\u5b9e\u9645\u5b89\u88c5\u8def\u5f84\u3002<\/p>\n<\/p>\n<ol start=\"4\">\n<li>\u4fdd\u5b58\u6587\u4ef6\u5e76\u9000\u51fa\u7f16\u8f91\u5668\u3002<\/li>\n<li>\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u4f7f\u66f4\u6539\u751f\u6548\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-sh\">source ~\/.bashrc<\/p>\n<p><\/code><\/pre>\n<\/p>\n<hr>\n<p><h2>\u4e09\u3001\u7f16\u5199Python\u811a\u672c<\/h2>\n<\/p>\n<p><p>\u5728\u5b89\u88c5\u548c\u914d\u7f6e\u597dPython\u73af\u5883\u540e\uff0c\u63a5\u4e0b\u6765\u9700\u8981\u7f16\u5199\u4e00\u4e2aPython\u811a\u672c\u3002Python\u811a\u672c\u662f\u4e00\u4e2a\u5305\u542bPython\u4ee3\u7801\u7684\u6587\u4ef6\uff0c\u6587\u4ef6\u6269\u5c55\u540d\u901a\u5e38\u4e3a<code>.py<\/code>\u3002<\/p>\n<\/p>\n<p><h3>1\u3001\u521b\u5efaPython\u811a\u672c<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\uff08\u4f8b\u5982\uff1aNotepad\u3001Sublime Text\u3001Visual Studio Code\u7b49\uff09\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u6587\u4ef6\uff0c\u5e76\u5c06\u5176\u4fdd\u5b58\u4e3a<code>.py<\/code>\u6587\u4ef6\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code>hello.py<\/code>\u7684\u6587\u4ef6\uff0c\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">print(&quot;Hello, World!&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>2\u3001\u4fdd\u5b58Python\u811a\u672c<\/h3>\n<\/p>\n<p><p>\u5c06\u6587\u4ef6\u4fdd\u5b58\u5230\u4e00\u4e2a\u6613\u4e8e\u8bbf\u95ee\u7684\u76ee\u5f55\u4e2d\uff0c\u4f8b\u5982\u684c\u9762\u6216\u6587\u6863\u6587\u4ef6\u5939\u3002\u786e\u4fdd\u6587\u4ef6\u540d\u4ee5<code>.py<\/code>\u7ed3\u5c3e\uff0c\u8fd9\u6837\u64cd\u4f5c\u7cfb\u7edf\u5c31\u4f1a\u5c06\u5176\u8bc6\u522b\u4e3aPython\u811a\u672c\u3002<\/p>\n<\/p>\n<hr>\n<p><h2>\u56db\u3001\u4f7f\u7528\u547d\u4ee4\u884c\u8fd0\u884c\u811a\u672c<\/h2>\n<\/p>\n<p><p>\u5728\u5b8c\u6210\u4e0a\u8ff0\u6b65\u9aa4\u540e\uff0c\u60a8\u5c31\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u884c\u6765\u8fd0\u884cPython\u811a\u672c\u4e86\u3002\u4ee5\u4e0b\u662f\u5982\u4f55\u5728\u4e0d\u540c\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u901a\u8fc7\u547d\u4ee4\u884c\u8fd0\u884cPython\u811a\u672c\u7684\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><h3>1\u3001Windows\u7cfb\u7edf<\/h3>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08cmd\uff09\u6216PowerShell\u3002<\/li>\n<li>\u4f7f\u7528<code>cd<\/code>\u547d\u4ee4\u5bfc\u822a\u5230Python\u811a\u672c\u6240\u5728\u7684\u76ee\u5f55\u3002\u4f8b\u5982\uff0c\u5982\u679c\u811a\u672c\u4f4d\u4e8e\u684c\u9762\uff0c\u53ef\u4ee5\u8f93\u5165\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-sh\">cd Desktop<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"3\">\n<li>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8fd0\u884cPython\u811a\u672c\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-sh\">python hello.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u4e00\u5207\u6b63\u5e38\uff0c\u60a8\u5c06\u770b\u5230\u8f93\u51fa\u201cHello, World!\u201d\u3002<\/p>\n<\/p>\n<p><h3>2\u3001Mac\u548cLinux\u7cfb\u7edf<\/h3>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u7ec8\u7aef\u3002<\/li>\n<li>\u4f7f\u7528<code>cd<\/code>\u547d\u4ee4\u5bfc\u822a\u5230Python\u811a\u672c\u6240\u5728\u7684\u76ee\u5f55\u3002\u4f8b\u5982\uff0c\u5982\u679c\u811a\u672c\u4f4d\u4e8e\u684c\u9762\uff0c\u53ef\u4ee5\u8f93\u5165\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-sh\">cd ~\/Desktop<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"3\">\n<li>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8fd0\u884cPython\u811a\u672c\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-sh\">python3 hello.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u4e00\u5207\u6b63\u5e38\uff0c\u60a8\u5c06\u770b\u5230\u8f93\u51fa\u201cHello, World!\u201d\u3002<\/p>\n<\/p>\n<hr>\n<p><h2>\u4e94\u3001\u5e38\u89c1\u95ee\u9898\u4e0e\u89e3\u51b3\u65b9\u6848<\/h2>\n<\/p>\n<p><p>\u5728\u4f7f\u7528\u547d\u4ee4\u884c\u8fd0\u884cPython\u811a\u672c\u65f6\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\u6848\u3002<\/p>\n<\/p>\n<p><h3>1\u3001Python\u672a\u6dfb\u52a0\u5230\u8def\u5f84<\/h3>\n<\/p>\n<p><p>\u5982\u679c\u5728\u8fd0\u884cPython\u811a\u672c\u65f6\u6536\u5230\u7c7b\u4f3c\u201cpython: command not found\u201d\u6216\u201cpython \u4e0d\u662f\u5185\u90e8\u6216\u5916\u90e8\u547d\u4ee4\u201d\u7684\u9519\u8bef\u4fe1\u606f\uff0c\u53ef\u80fd\u662f\u56e0\u4e3aPython\u672a\u6b63\u786e\u6dfb\u52a0\u5230\u73af\u5883\u53d8\u91cf\u4e2d\u3002\u8bf7\u91cd\u65b0\u68c0\u67e5\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u3002<\/p>\n<\/p>\n<p><h3>2\u3001\u7248\u672c\u51b2\u7a81<\/h3>\n<\/p>\n<p><p>\u5982\u679c\u60a8\u7684\u7cfb\u7edf\u4e2d\u540c\u65f6\u5b89\u88c5\u4e86\u591a\u4e2a\u7248\u672c\u7684Python\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u7248\u672c\u51b2\u7a81\u3002\u5728\u547d\u4ee4\u884c\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u67e5\u770b\u5f53\u524d\u4f7f\u7528\u7684Python\u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">python --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u9700\u8981\u5207\u6362\u5230\u5176\u4ed6\u7248\u672c\uff0c\u53ef\u4ee5\u4f7f\u7528\u5b8c\u6574\u8def\u5f84\u6765\u8fd0\u884cPython\u811a\u672c\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">C:\\Python38\\python.exe hello.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>3\u3001\u6743\u9650\u95ee\u9898<\/h3>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u7ba1\u7406\u5458\u6743\u9650\u6765\u8fd0\u884cPython\u811a\u672c\u6216\u5b89\u88c5\u8f6f\u4ef6\u5305\u3002\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u53f3\u952e\u70b9\u51fb\u547d\u4ee4\u63d0\u793a\u7b26\u56fe\u6807\u5e76\u9009\u62e9\u201c\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u8fd0\u884c\u201d\u3002\u5728Mac\u548cLinux\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u5728\u547d\u4ee4\u524d\u6dfb\u52a0<code>sudo<\/code>\u4ee5\u83b7\u5f97\u7ba1\u7406\u5458\u6743\u9650\u3002<\/p>\n<\/p>\n<hr>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u60a8\u53ef\u4ee5\u8f7b\u677e\u5730\u5728\u547d\u4ee4\u884c\u4e2d\u8fd0\u884cPython\u811a\u672c\u3002\u65e0\u8bba\u60a8\u662f\u65b0\u624b\u8fd8\u662f\u7ecf\u9a8c\u4e30\u5bcc\u7684\u5f00\u53d1\u8005\uff0c\u638c\u63e1\u8fd9\u4e9b\u57fa\u672c\u6280\u80fd\u90fd\u662f\u975e\u5e38\u6709\u7528\u7684\u3002\u5e0c\u671b\u8fd9\u7bc7\u6587\u7ae0\u80fd\u5e2e\u52a9\u60a8\u987a\u5229\u5730\u5728\u547d\u4ee4\u884c\u4e2d\u8fd0\u884cPython\u811a\u672c\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728\u547d\u4ee4\u884c\u4e2d\u627e\u5230Python\u811a\u672c\u7684\u7edd\u5bf9\u8def\u5f84\uff1f<\/strong><br \/>\u5728\u547d\u4ee4\u884c\u4e2d\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528<code>cd<\/code>\u547d\u4ee4\u5207\u6362\u5230\u5305\u542bPython\u811a\u672c\u7684\u76ee\u5f55\uff0c\u7136\u540e\u4f7f\u7528<code>pwd<\/code>\uff08\u5728Linux\u548cMac\u4e0a\uff09\u6216<code>cd<\/code>\uff08\u5728Windows\u4e0a\uff09\u6765\u663e\u793a\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u7684\u7edd\u5bf9\u8def\u5f84\u3002\u5728\u6b64\u57fa\u7840\u4e0a\uff0c\u60a8\u53ef\u4ee5\u5c06\u811a\u672c\u6587\u4ef6\u540d\u9644\u52a0\u5230\u8fd9\u4e2a\u8def\u5f84\uff0c\u4ee5\u83b7\u53d6\u5b8c\u6574\u7684\u811a\u672c\u6587\u4ef6\u8def\u5f84\u3002<\/p>\n<p><strong>\u547d\u4ee4\u884c\u8fd0\u884cPython\u811a\u672c\u65f6\u9700\u8981\u6ce8\u610f\u54ea\u4e9b\u4e8b\u9879\uff1f<\/strong><br \/>\u5728\u8fd0\u884cPython\u811a\u672c\u65f6\uff0c\u9700\u8981\u786e\u4fdd\u60a8\u7684\u547d\u4ee4\u884c\u5df2\u7ecf\u5b89\u88c5\u4e86Python\uff0c\u5e76\u4e14\u76f8\u5e94\u7684\u73af\u5883\u53d8\u91cf\u5df2\u8bbe\u7f6e\u3002\u60a8\u8fd8\u9700\u8981\u68c0\u67e5\u811a\u672c\u662f\u5426\u5177\u6709\u6267\u884c\u6743\u9650\uff08\u5728Linux\u548cMac\u4e0a\uff09\uff0c\u5e76\u786e\u8ba4Python\u7684\u7248\u672c\u4e0e\u811a\u672c\u517c\u5bb9\u3002\u4f8b\u5982\uff0c\u4f7f\u7528<code>python script.py<\/code>\u6216<code>python3 script.py<\/code>\u6765\u8fd0\u884c\u811a\u672c\u65f6\uff0c\u8bf7\u786e\u4fdd\u4f7f\u7528\u7684\u662f\u6b63\u786e\u7684Python\u547d\u4ee4\u3002<\/p>\n<p><strong>\u5982\u679c\u8fd0\u884cPython\u811a\u672c\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u5e94\u8be5\u5982\u4f55\u6392\u67e5\u95ee\u9898\uff1f<\/strong><br \/>\u5f53\u8fd0\u884cPython\u811a\u672c\u65f6\uff0c\u5982\u679c\u9047\u5230\u9519\u8bef\u4fe1\u606f\uff0c\u5efa\u8bae\u4ed4\u7ec6\u9605\u8bfb\u9519\u8bef\u63d0\u793a\uff0c\u901a\u5e38\u53ef\u4ee5\u63d0\u4f9b\u5173\u4e8e\u95ee\u9898\u7684\u7ebf\u7d22\u3002\u5e38\u89c1\u7684\u9519\u8bef\u5305\u62ec\u8bed\u6cd5\u9519\u8bef\u3001\u6a21\u5757\u672a\u627e\u5230\u6216\u6743\u9650\u95ee\u9898\u3002\u60a8\u53ef\u4ee5\u5c1d\u8bd5\u5728\u547d\u4ee4\u884c\u4e2d\u4f7f\u7528<code>python -m pdb script.py<\/code>\u6765\u8c03\u8bd5\u811a\u672c\uff0c\u6216\u8005\u5728\u811a\u672c\u4e2d\u6dfb\u52a0\u6253\u5370\u8bed\u53e5\uff0c\u4ee5\u4fbf\u66f4\u597d\u5730\u4e86\u89e3\u7a0b\u5e8f\u7684\u6267\u884c\u6d41\u7a0b\u548c\u51fa\u73b0\u95ee\u9898\u7684\u5177\u4f53\u4f4d\u7f6e\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u547d\u4ee4\u884c\u8fd0\u884cPython\u811a\u672c\u6587\u4ef6\u8def\u5f84\u7684\u6b65\u9aa4\uff1a\u5b89\u88c5Python\u3001\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3001\u7f16\u5199Python\u811a\u672c\u3001\u4f7f\u7528\u547d\u4ee4\u884c\u8fd0\u884c [&hellip;]","protected":false},"author":3,"featured_media":1127352,"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\/1127348"}],"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=1127348"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1127348\/revisions"}],"predecessor-version":[{"id":1127353,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1127348\/revisions\/1127353"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1127352"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1127348"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1127348"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1127348"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}