{"id":971024,"date":"2024-12-27T05:31:12","date_gmt":"2024-12-26T21:31:12","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/971024.html"},"modified":"2024-12-27T05:31:14","modified_gmt":"2024-12-26T21:31:14","slug":"python%e4%bb%a3%e7%a0%81%e6%96%87%e4%bb%b6%e5%a6%82%e4%bd%95%e8%bf%90%e8%a1%8c","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/971024.html","title":{"rendered":"Python\u4ee3\u7801\u6587\u4ef6\u5982\u4f55\u8fd0\u884c"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24194047\/dc3fb426-4790-44b9-b8c0-34c09069a7e1.webp\" alt=\"Python\u4ee3\u7801\u6587\u4ef6\u5982\u4f55\u8fd0\u884c\" \/><\/p>\n<p><p> <strong>\u8981\u8fd0\u884cPython\u4ee3\u7801\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528\u591a\u79cd\u65b9\u6cd5\uff0c\u5305\u62ec\u547d\u4ee4\u884c\u6267\u884c\u3001\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u8fd0\u884c\u3001\u4ee5\u53ca\u901a\u8fc7\u5728\u7ebf\u7f16\u8bd1\u5668\u7b49\u65b9\u5f0f\u3002\u63a8\u8350\u4f7f\u7528\u547d\u4ee4\u884c\u6267\u884c\uff0c\u56e0\u4e3a\u5b83\u66f4\u76f4\u63a5\u3001\u66f4\u9002\u5408\u521d\u5b66\u8005\u8fdb\u884c\u5b66\u4e60\u548c\u8c03\u8bd5\u3002<\/strong> \u5728\u547d\u4ee4\u884c\u4e2d\u8fd0\u884cPython\u4ee3\u7801\u6587\u4ef6\uff0c\u9996\u5148\u9700\u8981\u786e\u4fdd\u5df2\u7ecf\u5728\u8ba1\u7b97\u673a\u4e0a\u5b89\u88c5\u4e86Python\u89e3\u91ca\u5668\u3002\u7136\u540e\u53ef\u4ee5\u901a\u8fc7\u6253\u5f00\u547d\u4ee4\u884c\u754c\u9762\uff08Windows\u4e2d\u7684\u547d\u4ee4\u63d0\u793a\u7b26\u3001macOS\u548cLinux\u4e2d\u7684\u7ec8\u7aef\uff09\u5e76\u5bfc\u822a\u5230Python\u6587\u4ef6\u6240\u5728\u7684\u76ee\u5f55\uff0c\u4f7f\u7528\u547d\u4ee4<code>python filename.py<\/code>\u6267\u884c\u6587\u4ef6\u3002\u5728\u8fd9\u91cc\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u8bb2\u89e3\u5982\u4f55\u5728\u4e0d\u540c\u73af\u5883\u4e0b\u8fd0\u884cPython\u4ee3\u7801\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u547d\u4ee4\u884c\u8fd0\u884c<\/p>\n<\/p>\n<p><p>\u5728\u547d\u4ee4\u884c\u4e2d\u8fd0\u884cPython\u4ee3\u7801\u6587\u4ef6\u662f\u6700\u57fa\u7840\u4e14\u5e38\u7528\u7684\u65b9\u6cd5\u3002\u8981\u5728\u547d\u4ee4\u884c\u4e2d\u8fd0\u884cPython\u811a\u672c\uff0c\u9996\u5148\u9700\u8981\u786e\u4fdd\u5df2\u7ecf\u5b89\u88c5\u4e86Python\uff0c\u5e76\u4e14\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e2d\u8bbf\u95eePython\u89e3\u91ca\u5668\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5b89\u88c5Python<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u8fd0\u884cPython\u4ee3\u7801\u4e4b\u524d\uff0c\u9996\u5148\u9700\u8981\u5728\u8ba1\u7b97\u673a\u4e0a\u5b89\u88c5Python\u3002Python\u63d0\u4f9b\u4e86\u5b98\u65b9\u5b89\u88c5\u5305\uff0c\u53ef\u4ee5\u4ecePython\u7684\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u9002\u7528\u4e8eWindows\u3001macOS\u6216Linux\u7684\u5b89\u88c5\u7a0b\u5e8f\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165<code>python --version<\/code>\u547d\u4ee4\u68c0\u67e5\u5b89\u88c5\u662f\u5426\u6210\u529f\u3002\u5982\u679c\u6210\u529f\u5b89\u88c5\uff0c\u547d\u4ee4\u884c\u5c06\u8f93\u51faPython\u7684\u7248\u672c\u53f7\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528\u547d\u4ee4\u884c\u8fd0\u884cPython\u4ee3\u7801<\/strong><\/p>\n<\/p>\n<p><p>\u4e00\u65e6\u5b89\u88c5\u4e86Python\uff0c\u6253\u5f00\u547d\u4ee4\u884c\u5de5\u5177\u3002\u5bf9\u4e8eWindows\u7528\u6237\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u63d0\u793a\u7b26\uff08cmd\uff09\u6216PowerShell\uff1b\u5bf9\u4e8emacOS\u548cLinux\u7528\u6237\uff0c\u53ef\u4ee5\u4f7f\u7528\u7ec8\u7aef\u5e94\u7528\u7a0b\u5e8f\u3002\u5bfc\u822a\u5230\u5305\u542bPython\u4ee3\u7801\u6587\u4ef6\u7684\u76ee\u5f55\uff0c\u4f7f\u7528<code>cd<\/code>\u547d\u4ee4\u66f4\u6539\u76ee\u5f55\u3002\u4f8b\u5982\uff0c\u5982\u679c\u6587\u4ef6\u4f4d\u4e8e\u684c\u9762\uff0c\u53ef\u4ee5\u8f93\u5165<code>cd Desktop<\/code>\u3002\u7136\u540e\u8f93\u5165<code>python filename.py<\/code>\u6765\u8fd0\u884c\u4ee3\u7801\uff0c\u5176\u4e2d<code>filename.py<\/code>\u662f\u4f60\u7684Python\u6587\u4ef6\u7684\u540d\u79f0\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e8c\u3001\u4f7f\u7528\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09<\/p>\n<\/p>\n<p><p>\u4f7f\u7528IDE\u662f\u8fd0\u884cPython\u4ee3\u7801\u6587\u4ef6\u7684\u53e6\u4e00\u79cd\u5e38\u7528\u65b9\u6cd5\u3002IDE\u63d0\u4f9b\u4e86\u4e00\u4e2a\u96c6\u6210\u7684\u73af\u5883\u6765\u7f16\u5199\u3001\u8c03\u8bd5\u548c\u8fd0\u884c\u4ee3\u7801\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u6d41\u884c\u7684Python IDE\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>PyCharm<\/strong><\/p>\n<\/p>\n<p><p>PyCharm\u662f\u4e00\u4e2a\u5f3a\u5927\u7684Python\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff0c\u63d0\u4f9b\u4e86\u4ee3\u7801\u8865\u5168\u3001\u8c03\u8bd5\u5de5\u5177\u3001\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u96c6\u6210\u7b49\u529f\u80fd\u3002\u8981\u5728PyCharm\u4e2d\u8fd0\u884cPython\u4ee3\u7801\uff0c\u53ea\u9700\u6253\u5f00\u6216\u521b\u5efa\u4e00\u4e2aPython\u9879\u76ee\uff0c\u5c06\u4ee3\u7801\u6587\u4ef6\u6dfb\u52a0\u5230\u9879\u76ee\u4e2d\uff0c\u7136\u540e\u70b9\u51fb\u8fd0\u884c\u6309\u94ae\u5373\u53ef\u6267\u884c\u4ee3\u7801\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>Visual Studio Code<\/strong><\/p>\n<\/p>\n<p><p>Visual Studio Code\u662f\u4e00\u6b3e\u8f7b\u91cf\u7ea7\u7684\u4ee3\u7801\u7f16\u8f91\u5668\uff0c\u652f\u6301\u591a\u79cd\u7f16\u7a0b\u8bed\u8a00\uff0c\u5305\u62ecPython\u3002\u901a\u8fc7\u5b89\u88c5Python\u6269\u5c55\uff0cVisual Studio Code\u53ef\u4ee5\u63d0\u4f9b\u7c7b\u4f3cIDE\u7684\u529f\u80fd\u3002\u5728Visual Studio Code\u4e2d\uff0c\u6253\u5f00Python\u6587\u4ef6\u5e76\u6309\u4e0b<code>F5<\/code>\u952e\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884c\u4ee3\u7801\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001\u5728\u7ebf\u7f16\u8bd1\u5668<\/p>\n<\/p>\n<p><p>\u5bf9\u4e8e\u521d\u5b66\u8005\u6216\u4e0d\u65b9\u4fbf\u5728\u672c\u5730\u5b89\u88c5Python\u7684\u7528\u6237\uff0c\u53ef\u4ee5\u4f7f\u7528\u5728\u7ebf\u7f16\u8bd1\u5668\u6765\u8fd0\u884cPython\u4ee3\u7801\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u6d41\u884c\u7684\u5728\u7ebfPython\u7f16\u8bd1\u5668\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>Repl.it<\/strong><\/p>\n<\/p>\n<p><p>Repl.it\u662f\u4e00\u6b3e\u6d41\u884c\u7684\u5728\u7ebf\u7f16\u7a0b\u5e73\u53f0\uff0c\u652f\u6301\u591a\u79cd\u7f16\u7a0b\u8bed\u8a00\uff0c\u5305\u62ecPython\u3002\u7528\u6237\u53ef\u4ee5\u5728Repl.it\u4e0a\u521b\u5efaPython\u9879\u76ee\uff0c\u7f16\u5199\u4ee3\u7801\uff0c\u5e76\u901a\u8fc7\u70b9\u51fb\u201cRun\u201d\u6309\u94ae\u6765\u6267\u884c\u4ee3\u7801\u3002Repl.it\u8fd8\u63d0\u4f9b\u4e86\u5b9e\u65f6\u534f\u4f5c\u529f\u80fd\uff0c\u65b9\u4fbf\u7528\u6237\u4e0e\u4ed6\u4eba\u5171\u540c\u7f16\u5199\u548c\u8c03\u8bd5\u4ee3\u7801\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>Google Colab<\/strong><\/p>\n<\/p>\n<p><p>Google Colab\u662f\u4e00\u4e2a\u57fa\u4e8eJupyter Notebook\u7684\u5728\u7ebf\u7f16\u7a0b\u5e73\u53f0\uff0c\u4e3b\u8981\u7528\u4e8e\u6570\u636e\u79d1\u5b66\u548c<a href=\"https:\/\/docs.pingcode.com\/ask\/59192.html\" target=\"_blank\">\u673a\u5668\u5b66\u4e60<\/a>\u4efb\u52a1\u3002\u7528\u6237\u53ef\u4ee5\u5728Google Colab\u4e2d\u7f16\u5199\u548c\u8fd0\u884cPython\u4ee3\u7801\uff0c\u5e76\u5229\u7528Google\u7684\u8ba1\u7b97\u8d44\u6e90\u8fdb\u884c\u590d\u6742\u8ba1\u7b97\u3002Google Colab\u8fd8\u652f\u6301Markdown\u548cLaTeX\u683c\u5f0f\uff0c\u65b9\u4fbf\u7528\u6237\u521b\u5efa\u4ea4\u4e92\u5f0f\u548c\u6587\u6863\u5316\u7684\u4ee3\u7801\u7b14\u8bb0\u672c\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u56db\u3001Python\u6587\u4ef6\u7684\u6267\u884c\u7ec6\u8282<\/p>\n<\/p>\n<p><p>\u5728\u8fd0\u884cPython\u4ee3\u7801\u6587\u4ef6\u65f6\uff0c\u6709\u4e00\u4e9b\u91cd\u8981\u7684\u7ec6\u8282\u9700\u8981\u6ce8\u610f\uff0c\u4ee5\u786e\u4fdd\u4ee3\u7801\u80fd\u591f\u6b63\u786e\u6267\u884c\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u68c0\u67e5\u4ee3\u7801\u7684\u517c\u5bb9\u6027<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u7f16\u5199\u548c\u8fd0\u884cPython\u4ee3\u7801\u65f6\uff0c\u786e\u4fdd\u4ee3\u7801\u4e0ePython\u7248\u672c\u7684\u517c\u5bb9\u6027\u975e\u5e38\u91cd\u8981\u3002Python 2\u548cPython 3\u4e4b\u95f4\u5b58\u5728\u4e00\u4e9b\u4e0d\u517c\u5bb9\u7684\u53d8\u5316\uff0c\u56e0\u6b64\u5728\u4f7f\u7528\u7279\u5b9a\u7248\u672c\u7684Python\u65f6\uff0c\u9700\u8981\u786e\u4fdd\u4ee3\u7801\u7b26\u5408\u8be5\u7248\u672c\u7684\u8bed\u6cd5\u548c\u529f\u80fd\u3002\u4f8b\u5982\uff0cPython 2\u4e2d\u4f7f\u7528<code>print<\/code>\u8bed\u53e5\uff0c\u800c\u5728Python 3\u4e2d\u5219\u4f7f\u7528<code>print()<\/code>\u51fd\u6570\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5904\u7406\u9519\u8bef\u548c\u5f02\u5e38<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u8fd0\u884cPython\u4ee3\u7801\u65f6\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u5404\u79cd\u9519\u8bef\u548c\u5f02\u5e38\u3002\u5e38\u89c1\u7684\u9519\u8bef\u5305\u62ec\u8bed\u6cd5\u9519\u8bef\u3001\u8fd0\u884c\u65f6\u9519\u8bef\u548c\u903b\u8f91\u9519\u8bef\u3002\u4e3a\u4e86\u63d0\u9ad8\u4ee3\u7801\u7684\u7a33\u5b9a\u6027\u548c\u53ef\u7ef4\u62a4\u6027\uff0c\u53ef\u4ee5\u4f7f\u7528<code>try<\/code>\u548c<code>except<\/code>\u8bed\u53e5\u6765\u6355\u83b7\u548c\u5904\u7406\u5f02\u5e38\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">try:<\/p>\n<p>    # \u53ef\u80fd\u53d1\u751f\u9519\u8bef\u7684\u4ee3\u7801<\/p>\n<p>except Exception as e:<\/p>\n<p>    print(f&quot;An error occurred: {e}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528\u865a\u62df\u73af\u5883<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u5f00\u53d1Python\u9879\u76ee\u65f6\uff0c\u5efa\u8bae\u4f7f\u7528\u865a\u62df\u73af\u5883\u6765\u9694\u79bb\u9879\u76ee\u7684\u4f9d\u8d56\u5173\u7cfb\u3002\u865a\u62df\u73af\u5883\u5141\u8bb8\u7528\u6237\u4e3a\u6bcf\u4e2a\u9879\u76ee\u521b\u5efa\u72ec\u7acb\u7684Python\u73af\u5883\uff0c\u786e\u4fdd\u4e0d\u540c\u9879\u76ee\u4e4b\u95f4\u7684\u4f9d\u8d56\u4e0d\u4f1a\u51b2\u7a81\u3002\u53ef\u4ee5\u4f7f\u7528<code>venv<\/code>\u6a21\u5757\u521b\u5efa\u865a\u62df\u73af\u5883\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python -m venv myenv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u5e76\u5b89\u88c5\u6240\u9700\u7684\u5e93\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\"># Windows<\/p>\n<p>myenv\\Scripts\\activate<\/p>\n<h2><strong>macOS\u548cLinux<\/strong><\/h2>\n<p>source myenv\/bin\/activate<\/p>\n<p>pip install -r requirements.txt<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e94\u3001\u8c03\u8bd5Python\u4ee3\u7801<\/p>\n<\/p>\n<p><p>\u5728\u8fd0\u884cPython\u4ee3\u7801\u65f6\uff0c\u8c03\u8bd5\u662f\u4e00\u4e2a\u91cd\u8981\u7684\u6b65\u9aa4\u3002\u8c03\u8bd5\u53ef\u4ee5\u5e2e\u52a9\u5f00\u53d1\u8005\u627e\u51fa\u4ee3\u7801\u4e2d\u7684\u9519\u8bef\uff0c\u5e76\u63d0\u9ad8\u4ee3\u7801\u7684\u8d28\u91cf\u548c\u6027\u80fd\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4f7f\u7528\u65ad\u70b9<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u8c03\u8bd5\u4ee3\u7801\u65f6\uff0c\u65ad\u70b9\u662f\u4e00\u4e2a\u5e38\u7528\u7684\u5de5\u5177\u3002\u65ad\u70b9\u5141\u8bb8\u5f00\u53d1\u8005\u5728\u7a0b\u5e8f\u6267\u884c\u8fc7\u7a0b\u4e2d\u6682\u505c\u4ee3\u7801\uff0c\u5e76\u68c0\u67e5\u53d8\u91cf\u7684\u503c\u548c\u7a0b\u5e8f\u7684\u72b6\u6001\u3002\u5927\u591a\u6570IDE\uff08\u5982PyCharm\u548cVisual Studio Code\uff09\u90fd\u652f\u6301\u8bbe\u7f6e\u65ad\u70b9\u548c\u8c03\u8bd5\u529f\u80fd\u3002\u901a\u8fc7\u5728\u4ee3\u7801\u884c\u4e0a\u70b9\u51fb\u5de6\u4fa7\u8fb9\u680f\uff0c\u53ef\u4ee5\u8bbe\u7f6e\u65ad\u70b9\uff0c\u7136\u540e\u4f7f\u7528\u8c03\u8bd5\u6a21\u5f0f\u8fd0\u884c\u7a0b\u5e8f\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528\u8c03\u8bd5\u5de5\u5177<\/strong><\/p>\n<\/p>\n<p><p>Python\u5185\u7f6e\u4e86\u4e00\u4e2a\u540d\u4e3a<code>pdb<\/code>\u7684\u8c03\u8bd5\u5de5\u5177\uff0c\u5141\u8bb8\u5f00\u53d1\u8005\u5728\u547d\u4ee4\u884c\u4e2d\u8c03\u8bd5Python\u4ee3\u7801\u3002\u53ef\u4ee5\u5728\u4ee3\u7801\u4e2d\u63d2\u5165<code>import pdb; pdb.set_trace()<\/code>\u6765\u542f\u52a8\u8c03\u8bd5\u5668\u3002\u8c03\u8bd5\u5668\u63d0\u4f9b\u4e86\u591a\u79cd\u547d\u4ee4\uff0c\u5982<code>n<\/code>\uff08\u4e0b\u4e00\u884c\uff09\u3001<code>c<\/code>\uff08\u7ee7\u7eed\u6267\u884c\uff09\u3001<code>q<\/code>\uff08\u9000\u51fa\u8c03\u8bd5\u5668\uff09\u7b49\uff0c\u5e2e\u52a9\u5f00\u53d1\u8005\u8ddf\u8e2a\u4ee3\u7801\u6267\u884c\u6d41\u7a0b\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u516d\u3001\u603b\u7ed3<\/p>\n<\/p>\n<p><p>\u8fd0\u884cPython\u4ee3\u7801\u6587\u4ef6\u7684\u65b9\u6cd5\u591a\u79cd\u591a\u6837\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u9700\u6c42\u548c\u73af\u5883\u9009\u62e9\u6700\u5408\u9002\u7684\u65b9\u6cd5\u3002\u65e0\u8bba\u662f\u4f7f\u7528\u547d\u4ee4\u884c\u3001IDE\u8fd8\u662f\u5728\u7ebf\u7f16\u8bd1\u5668\uff0c\u7406\u89e3Python\u4ee3\u7801\u6267\u884c\u7684\u57fa\u672c\u539f\u7406\u548c\u8c03\u8bd5\u6280\u5de7\u90fd\u662f\u975e\u5e38\u91cd\u8981\u7684\u3002\u901a\u8fc7\u4e0d\u65ad\u5b9e\u8df5\u548c\u63a2\u7d22\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u63d0\u9ad8\u7f16\u5199\u548c\u8fd0\u884cPython\u4ee3\u7801\u7684\u6548\u7387\uff0c\u5f00\u53d1\u51fa\u66f4\u9ad8\u8d28\u91cf\u7684\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728\u6211\u7684\u8ba1\u7b97\u673a\u4e0a\u8fd0\u884cPython\u4ee3\u7801\u6587\u4ef6\uff1f<\/strong><br \/>\u8981\u5728\u8ba1\u7b97\u673a\u4e0a\u8fd0\u884cPython\u4ee3\u7801\u6587\u4ef6\uff0c\u60a8\u9700\u8981\u786e\u4fdd\u5df2\u7ecf\u5b89\u88c5\u4e86Python\u73af\u5883\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u884c\u7ec8\u7aef\uff0c\u5bfc\u822a\u5230\u4ee3\u7801\u6587\u4ef6\u6240\u5728\u7684\u76ee\u5f55\uff0c\u8f93\u5165<code>python \u6587\u4ef6\u540d.py<\/code>\uff08\u4f8b\u5982\uff0c<code>python hello.py<\/code>\uff09\u6765\u6267\u884c\u4ee3\u7801\u3002\u5982\u679c\u60a8\u4f7f\u7528\u7684\u662fPython 3\uff0c\u53ef\u80fd\u9700\u8981\u8f93\u5165<code>python3 \u6587\u4ef6\u540d.py<\/code>\u6765\u8fd0\u884c\u3002<\/p>\n<p><strong>\u6211\u53ef\u4ee5\u4f7f\u7528\u54ea\u79cd\u7f16\u8f91\u5668\u6765\u7f16\u5199\u548c\u8fd0\u884cPython\u4ee3\u7801\uff1f<\/strong><br \/>\u6709\u591a\u79cd\u7f16\u8f91\u5668\u53ef\u4ee5\u7528\u6765\u7f16\u5199\u548c\u8fd0\u884cPython\u4ee3\u7801\u3002\u5e38\u89c1\u7684\u9009\u62e9\u5305\u62ecPyCharm\u3001Visual Studio Code\u3001Jupyter Notebook\u548cSublime Text\u7b49\u3002\u8fd9\u4e9b\u5de5\u5177\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u529f\u80fd\uff0c\u5982\u4ee3\u7801\u8865\u5168\u3001\u8c03\u8bd5\u548c\u7248\u672c\u63a7\u5236\uff0c\u4f7f\u5f97\u7f16\u7a0b\u4f53\u9a8c\u66f4\u52a0\u9ad8\u6548\u548c\u6109\u5feb\u3002<\/p>\n<p><strong>\u5982\u4f55\u8c03\u8bd5\u6211\u7684Python\u4ee3\u7801\u4ee5\u627e\u51fa\u9519\u8bef\uff1f<\/strong><br \/>\u8c03\u8bd5Python\u4ee3\u7801\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\u8fdb\u884c\u3002\u4f7f\u7528IDE\uff08\u5982PyCharm\uff09\u63d0\u4f9b\u7684\u8c03\u8bd5\u5de5\u5177\u662f\u4e00\u4e2a\u4e0d\u9519\u7684\u9009\u62e9\uff0c\u5b83\u5141\u8bb8\u60a8\u9010\u884c\u6267\u884c\u4ee3\u7801\u5e76\u68c0\u67e5\u53d8\u91cf\u7684\u503c\u3002\u6b64\u5916\uff0c\u60a8\u4e5f\u53ef\u4ee5\u5728\u4ee3\u7801\u4e2d\u63d2\u5165<code>print()<\/code>\u8bed\u53e5\uff0c\u4ee5\u8f93\u51fa\u5173\u952e\u53d8\u91cf\u7684\u503c\uff0c\u6216\u8005\u4f7f\u7528Python\u5185\u7f6e\u7684<code>pdb<\/code>\u6a21\u5757\u6765\u8fdb\u884c\u66f4\u590d\u6742\u7684\u8c03\u8bd5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u8fd0\u884cPython\u4ee3\u7801\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528\u591a\u79cd\u65b9\u6cd5\uff0c\u5305\u62ec\u547d\u4ee4\u884c\u6267\u884c\u3001\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u8fd0\u884c\u3001\u4ee5\u53ca\u901a\u8fc7\u5728\u7ebf\u7f16\u8bd1\u5668\u7b49 [&hellip;]","protected":false},"author":3,"featured_media":971030,"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\/971024"}],"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=971024"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/971024\/revisions"}],"predecessor-version":[{"id":971032,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/971024\/revisions\/971032"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/971030"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=971024"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=971024"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=971024"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}