{"id":1158572,"date":"2025-01-13T18:42:24","date_gmt":"2025-01-13T10:42:24","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1158572.html"},"modified":"2025-01-13T18:42:26","modified_gmt":"2025-01-13T10:42:26","slug":"python%e4%b8%ad%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8idle","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1158572.html","title":{"rendered":"python\u4e2d\u5982\u4f55\u4f7f\u7528idle"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25200509\/215f1156-a9c9-4e29-91f7-ff3d99fb1566.webp\" alt=\"python\u4e2d\u5982\u4f55\u4f7f\u7528idle\" \/><\/p>\n<p><p> \u5728Python\u4e2d\u4f7f\u7528IDLE\uff08Integrated Development and Learning Environment\uff09\u7684\u65b9\u6cd5\u5305\u62ec\uff1a<strong>\u5b89\u88c5Python\u3001\u6253\u5f00IDLE\u3001\u4f7f\u7528\u7f16\u8f91\u7a97\u53e3\u3001\u4f7f\u7528\u4ea4\u4e92\u5f0fShell\u3001\u8c03\u8bd5\u4ee3\u7801<\/strong>\u3002\u5176\u4e2d\uff0c<strong>\u6253\u5f00IDLE<\/strong>\u662f\u5173\u952e\u6b65\u9aa4\u4e4b\u4e00\u3002<\/p>\n<\/p>\n<p><p>\u6253\u5f00IDLE\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u5728Windows\u4e0a\uff0c\u5982\u679c\u4f60\u5b89\u88c5\u4e86Python\uff0c\u53ef\u4ee5\u901a\u8fc7\u5f00\u59cb\u83dc\u5355\u627e\u5230\u201cIDLE (Python x.x)\u201d\u5e76\u70b9\u51fb\u6253\u5f00\u3002<\/li>\n<li>\u5728macOS\u6216Linux\u4e0a\uff0c\u4f60\u53ef\u4ee5\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165<code>idle<\/code>\u547d\u4ee4\u6765\u542f\u52a8IDLE\u3002<\/li>\n<\/ol>\n<p><p>\u8be6\u7ec6\u63cf\u8ff0\uff1a<\/p>\n<p>\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u901a\u8fc7\u5f00\u59cb\u83dc\u5355\u6253\u5f00IDLE\u540e\uff0c\u4f60\u4f1a\u770b\u5230\u4e00\u4e2a\u4ea4\u4e92\u5f0f\u7684Python Shell\u7a97\u53e3\u3002\u5728\u8fd9\u4e2a\u7a97\u53e3\u4e2d\uff0c\u4f60\u53ef\u4ee5\u8f93\u5165Python\u547d\u4ee4\u5e76\u7acb\u5373\u770b\u5230\u7ed3\u679c\u3002\u8fd9\u662f\u975e\u5e38\u6709\u5229\u4e8e\u6d4b\u8bd5\u548c\u8c03\u8bd5\u5c0f\u6bb5\u4ee3\u7801\u7684\u3002\u4f60\u8fd8\u53ef\u4ee5\u901a\u8fc7File\u83dc\u5355\u65b0\u5efa\u4e00\u4e2a\u6587\u4ef6\u6765\u521b\u5efa\u548c\u7f16\u8f91Python\u811a\u672c\u6587\u4ef6\uff0c\u4fdd\u5b58\u540e\u53ef\u4ee5\u901a\u8fc7Run\u83dc\u5355\u6267\u884c\u3002<\/p>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u66f4\u8be6\u7ec6\u7684\u89e3\u91ca\u548c\u5176\u4ed6\u65b9\u9762\u7684\u4ecb\u7ecd\uff1a<\/p>\n<\/p>\n<p><h2>\u4e00\u3001\u5b89\u88c5Python<\/h2>\n<\/p>\n<p><p>\u4e3a\u4e86\u4f7f\u7528IDLE\uff0c\u4f60\u9996\u5148\u9700\u8981\u5b89\u88c5Python\u3002Python\u7684\u5b98\u65b9\u7f51\u7ad9\u63d0\u4f9b\u4e86\u9002\u7528\u4e8e\u4e0d\u540c\u64cd\u4f5c\u7cfb\u7edf\u7684\u5b89\u88c5\u7a0b\u5e8f\u3002\u4ee5\u4e0b\u662f\u5b89\u88c5Python\u7684\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<p><h3>1. \u4e0b\u8f7dPython<\/h3>\n<\/p>\n<p><p>\u8bbf\u95eePython\u7684\u5b98\u65b9\u7f51\u7ad9\uff08<a href=\"https:\/\/www.python.org\/%EF%BC%89%EF%BC%8C%E5%9C%A8%E4%B8%8B%E8%BD%BD%E9%A1%B5%E9%9D%A2%E9%80%89%E6%8B%A9%E9%80%82%E5%90%88%E4%BD%A0%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E7%9A%84%E7%89%88%E6%9C%AC%E8%BF%9B%E8%A1%8C%E4%B8%8B%E8%BD%BD%E3%80%82%E5%BB%BA%E8%AE%AE%E9%80%89%E6%8B%A9%E6%9C%80%E6%96%B0%E7%9A%84%E7%A8%B3%E5%AE%9A%E7%89%88%E6%9C%AC%E3%80%82\">https:\/\/www.python.org\/\uff09\uff0c\u5728\u4e0b\u8f7d\u9875\u9762\u9009\u62e9\u9002\u5408\u4f60\u64cd\u4f5c\u7cfb\u7edf\u7684\u7248\u672c\u8fdb\u884c\u4e0b\u8f7d\u3002\u5efa\u8bae\u9009\u62e9\u6700\u65b0\u7684\u7a33\u5b9a\u7248\u672c\u3002<\/a><\/p>\n<\/p>\n<p><h3>2. \u5b89\u88c5Python<\/h3>\n<\/p>\n<p><p>\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\u3002\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u786e\u4fdd\u52fe\u9009\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u8fd9\u6837\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e2d\u76f4\u63a5\u4f7f\u7528<code>python<\/code>\u547d\u4ee4\u3002\u7136\u540e\uff0c\u70b9\u51fb\u201cInstall Now\u201d\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n<\/p>\n<p><h3>3. \u9a8c\u8bc1\u5b89\u88c5<\/h3>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6253\u5f00\u547d\u4ee4\u884c\u7a97\u53e3\uff08Windows\u4e0a\u662fcmd\uff0cmacOS\u548cLinux\u4e0a\u662f\u7ec8\u7aef\uff09\uff0c\u8f93\u5165<code>python --version<\/code>\u6216<code>python3 --version<\/code>\uff0c\u5982\u679c\u770b\u5230Python\u7248\u672c\u53f7\uff0c\u8bf4\u660e\u5b89\u88c5\u6210\u529f\u3002<\/p>\n<\/p>\n<p><h2>\u4e8c\u3001\u6253\u5f00IDLE<\/h2>\n<\/p>\n<p><p>\u5b89\u88c5Python\u65f6\uff0cIDLE\u901a\u5e38\u4f1a\u81ea\u52a8\u5b89\u88c5\u3002\u4ee5\u4e0b\u662f\u6253\u5f00IDLE\u7684\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<p><h3>1. Windows<\/h3>\n<\/p>\n<p><p>\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u901a\u8fc7\u5f00\u59cb\u83dc\u5355\u627e\u5230\u201cIDLE (Python x.x)\u201d\u5e76\u70b9\u51fb\u6253\u5f00\u3002\u4f60\u4f1a\u770b\u5230\u4e00\u4e2a\u4ea4\u4e92\u5f0f\u7684Python Shell\u7a97\u53e3\u3002<\/p>\n<\/p>\n<p><h3>2. macOS\u548cLinux<\/h3>\n<\/p>\n<p><p>\u5728macOS\u6216Linux\u7cfb\u7edf\u4e2d\uff0c\u4f60\u53ef\u4ee5\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165<code>idle<\/code>\u547d\u4ee4\u6765\u542f\u52a8IDLE\u3002\u5982\u679c\u5b89\u88c5\u4e86\u591a\u4e2a\u7248\u672c\u7684Python\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u8f93\u5165<code>idle3<\/code>\u547d\u4ee4\u3002<\/p>\n<\/p>\n<p><h2>\u4e09\u3001\u4f7f\u7528\u7f16\u8f91\u7a97\u53e3<\/h2>\n<\/p>\n<p><p>IDLE\u63d0\u4f9b\u4e86\u4e00\u4e2a\u7f16\u8f91\u7a97\u53e3\uff0c\u5141\u8bb8\u4f60\u7f16\u5199\u548c\u4fdd\u5b58Python\u811a\u672c\u3002\u4ee5\u4e0b\u662f\u4f7f\u7528\u7f16\u8f91\u7a97\u53e3\u7684\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<p><h3>1. \u65b0\u5efa\u6587\u4ef6<\/h3>\n<\/p>\n<p><p>\u5728IDLE\u4e2d\uff0c\u70b9\u51fb\u201cFile\u201d\u83dc\u5355\uff0c\u9009\u62e9\u201cNew File\u201d\u9009\u9879\u3002\u8fd9\u5c06\u6253\u5f00\u4e00\u4e2a\u65b0\u7684\u7f16\u8f91\u7a97\u53e3\uff0c\u4f60\u53ef\u4ee5\u5728\u5176\u4e2d\u7f16\u5199Python\u4ee3\u7801\u3002<\/p>\n<\/p>\n<p><h3>2. \u7f16\u5199\u4ee3\u7801<\/h3>\n<\/p>\n<p><p>\u5728\u7f16\u8f91\u7a97\u53e3\u4e2d\u8f93\u5165\u4f60\u7684Python\u4ee3\u7801\u3002\u4f8b\u5982\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>3. \u4fdd\u5b58\u6587\u4ef6<\/h3>\n<\/p>\n<p><p>\u70b9\u51fb\u201cFile\u201d\u83dc\u5355\uff0c\u9009\u62e9\u201cSave\u201d\u9009\u9879\uff0c\u5c06\u6587\u4ef6\u4fdd\u5b58\u4e3a<code>.py<\/code>\u6269\u5c55\u540d\u7684Python\u811a\u672c\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h2>\u56db\u3001\u4f7f\u7528\u4ea4\u4e92\u5f0fShell<\/h2>\n<\/p>\n<p><p>IDLE\u7684\u4ea4\u4e92\u5f0fShell\u7a97\u53e3\u662f\u4e00\u4e2a\u975e\u5e38\u6709\u7528\u7684\u5de5\u5177\uff0c\u5141\u8bb8\u4f60\u5feb\u901f\u6d4b\u8bd5\u548c\u8c03\u8bd5\u4ee3\u7801\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u4f7f\u7528\u4ea4\u4e92\u5f0fShell\u7684\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<p><h3>1. \u8f93\u5165\u547d\u4ee4<\/h3>\n<\/p>\n<p><p>\u5728Shell\u7a97\u53e3\u4e2d\uff0c\u4f60\u53ef\u4ee5\u76f4\u63a5\u8f93\u5165Python\u547d\u4ee4\u5e76\u6309\u56de\u8f66\u952e\u6267\u884c\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">&gt;&gt;&gt; print(&quot;Hello, World!&quot;)<\/p>\n<p>Hello, World!<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>2. \u67e5\u770b\u7ed3\u679c<\/h3>\n<\/p>\n<p><p>\u4f60\u8f93\u5165\u7684\u547d\u4ee4\u4f1a\u7acb\u5373\u6267\u884c\uff0c\u5e76\u663e\u793a\u7ed3\u679c\u3002\u8fd9\u5bf9\u4e8e\u6d4b\u8bd5\u5c0f\u6bb5\u4ee3\u7801\u975e\u5e38\u6709\u7528\u3002<\/p>\n<\/p>\n<p><h3>3. \u8c03\u7528\u51fd\u6570<\/h3>\n<\/p>\n<p><p>\u4f60\u53ef\u4ee5\u5728Shell\u7a97\u53e3\u4e2d\u5b9a\u4e49\u548c\u8c03\u7528\u51fd\u6570\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">&gt;&gt;&gt; def greet(name):<\/p>\n<p>...     return f&quot;Hello, {name}!&quot;<\/p>\n<p>...<\/p>\n<p>&gt;&gt;&gt; greet(&quot;Alice&quot;)<\/p>\n<p>&#39;Hello, Alice!&#39;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u4e94\u3001\u8c03\u8bd5\u4ee3\u7801<\/h2>\n<\/p>\n<p><p>IDLE\u63d0\u4f9b\u4e86\u4e00\u4e9b\u8c03\u8bd5\u5de5\u5177\uff0c\u5e2e\u52a9\u4f60\u67e5\u627e\u548c\u4fee\u590d\u4ee3\u7801\u4e2d\u7684\u9519\u8bef\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u7528\u7684\u8c03\u8bd5\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<p><h3>1. \u8bbe\u7f6e\u65ad\u70b9<\/h3>\n<\/p>\n<p><p>\u5728\u7f16\u8f91\u7a97\u53e3\u4e2d\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u70b9\u51fb\u884c\u53f7\u8bbe\u7f6e\u65ad\u70b9\u3002\u65ad\u70b9\u662f\u4ee3\u7801\u6267\u884c\u7684\u6682\u505c\u70b9\uff0c\u5141\u8bb8\u4f60\u68c0\u67e5\u53d8\u91cf\u7684\u503c\u548c\u7a0b\u5e8f\u7684\u72b6\u6001\u3002<\/p>\n<\/p>\n<p><h3>2. \u8fd0\u884c\u8c03\u8bd5\u5668<\/h3>\n<\/p>\n<p><p>\u70b9\u51fb\u201cRun\u201d\u83dc\u5355\uff0c\u9009\u62e9\u201cRun Module\u201d\u9009\u9879\uff08\u5feb\u6377\u952e\u662fF5\uff09\uff0c\u7136\u540e\u9009\u62e9\u201cDebug\u201d\u83dc\u5355\uff0c\u70b9\u51fb\u201cDebugger\u201d\u9009\u9879\u3002\u8c03\u8bd5\u5668\u5c06\u542f\u52a8\uff0c\u5e76\u5728\u65ad\u70b9\u5904\u6682\u505c\u6267\u884c\u3002<\/p>\n<\/p>\n<p><h3>3. \u6b65\u8fdb\u6267\u884c<\/h3>\n<\/p>\n<p><p>\u5728\u8c03\u8bd5\u5668\u4e2d\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u201cStep\u201d\u6309\u94ae\u9010\u884c\u6267\u884c\u4ee3\u7801\uff0c\u68c0\u67e5\u6bcf\u4e00\u6b65\u7684\u6267\u884c\u60c5\u51b5\u3002\u8fd9\u6709\u52a9\u4e8e\u627e\u51fa\u4ee3\u7801\u4e2d\u7684\u95ee\u9898\u3002<\/p>\n<\/p>\n<p><h3>4. \u68c0\u67e5\u53d8\u91cf<\/h3>\n<\/p>\n<p><p>\u5728\u8c03\u8bd5\u5668\u7a97\u53e3\u4e2d\uff0c\u4f60\u53ef\u4ee5\u67e5\u770b\u5f53\u524d\u6240\u6709\u53d8\u91cf\u7684\u503c\u3002\u8fd9\u6709\u52a9\u4e8e\u4f60\u4e86\u89e3\u7a0b\u5e8f\u7684\u72b6\u6001\u548c\u6570\u636e\u6d41\u3002<\/p>\n<\/p>\n<p><h2>\u516d\u3001\u4f7f\u7528\u6269\u5c55\u548c\u63d2\u4ef6<\/h2>\n<\/p>\n<p><p>IDLE\u8fd8\u652f\u6301\u4e00\u4e9b\u6269\u5c55\u548c\u63d2\u4ef6\uff0c\u53ef\u4ee5\u589e\u5f3a\u5176\u529f\u80fd\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u7528\u7684\u6269\u5c55\u548c\u63d2\u4ef6\uff1a<\/p>\n<\/p>\n<p><h3>1. AutoComplete<\/h3>\n<\/p>\n<p><p>IDLE\u81ea\u5e26\u7684\u81ea\u52a8\u8865\u5168\u529f\u80fd\uff0c\u53ef\u4ee5\u5e2e\u52a9\u4f60\u5feb\u901f\u8f93\u5165\u4ee3\u7801\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u6309\u4e0bTab\u952e\u6765\u89e6\u53d1\u81ea\u52a8\u8865\u5168\u3002<\/p>\n<\/p>\n<p><h3>2. Syntax Highlighting<\/h3>\n<\/p>\n<p><p>IDLE\u7684\u7f16\u8f91\u7a97\u53e3\u652f\u6301\u8bed\u6cd5\u9ad8\u4eae\u663e\u793a\uff0c\u8fd9\u4f7f\u5f97\u4ee3\u7801\u66f4\u5bb9\u6613\u9605\u8bfb\u548c\u7406\u89e3\u3002\u4e0d\u540c\u7684\u5173\u952e\u5b57\u3001\u53d8\u91cf\u548c\u5b57\u7b26\u4e32\u4f1a\u4ee5\u4e0d\u540c\u7684\u989c\u8272\u663e\u793a\u3002<\/p>\n<\/p>\n<p><h3>3. Third-Party Plugins<\/h3>\n<\/p>\n<p><p>\u4f60\u8fd8\u53ef\u4ee5\u5b89\u88c5\u4e00\u4e9b\u7b2c\u4e09\u65b9\u63d2\u4ef6\uff0c\u6269\u5c55IDLE\u7684\u529f\u80fd\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u5b89\u88c5<code>rope<\/code>\u63d2\u4ef6\uff0c\u589e\u52a0\u4ee3\u7801\u91cd\u6784\u529f\u80fd\u3002<\/p>\n<\/p>\n<p><h2>\u4e03\u3001\u914d\u7f6eIDLE<\/h2>\n<\/p>\n<p><p>\u4f60\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u9700\u8981\uff0c\u914d\u7f6eIDLE\u7684\u5916\u89c2\u548c\u884c\u4e3a\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684\u914d\u7f6e\u9009\u9879\uff1a<\/p>\n<\/p>\n<p><h3>1. \u66f4\u6539\u5b57\u4f53\u548c\u989c\u8272<\/h3>\n<\/p>\n<p><p>\u5728IDLE\u4e2d\uff0c\u70b9\u51fb\u201cOptions\u201d\u83dc\u5355\uff0c\u9009\u62e9\u201cConfigure IDLE\u201d\u9009\u9879\u3002\u5728\u201cFonts\/Tabs\u201d\u9009\u9879\u5361\u4e2d\uff0c\u4f60\u53ef\u4ee5\u66f4\u6539\u7f16\u8f91\u7a97\u53e3\u7684\u5b57\u4f53\u548c\u5b57\u4f53\u5927\u5c0f\u3002\u5728\u201cHighlighting\u201d\u9009\u9879\u5361\u4e2d\uff0c\u4f60\u53ef\u4ee5\u66f4\u6539\u8bed\u6cd5\u9ad8\u4eae\u663e\u793a\u7684\u989c\u8272\u3002<\/p>\n<\/p>\n<p><h3>2. \u914d\u7f6e\u81ea\u52a8\u8865\u5168<\/h3>\n<\/p>\n<p><p>\u5728\u201cOptions\u201d\u83dc\u5355\u4e2d\uff0c\u9009\u62e9\u201cConfigure IDLE\u201d\u9009\u9879\u3002\u5728\u201cGeneral\u201d\u9009\u9879\u5361\u4e2d\uff0c\u4f60\u53ef\u4ee5\u542f\u7528\u6216\u7981\u7528\u81ea\u52a8\u8865\u5168\u529f\u80fd\u3002<\/p>\n<\/p>\n<p><h3>3. \u914d\u7f6e\u7f29\u8fdb<\/h3>\n<\/p>\n<p><p>\u5728\u201cOptions\u201d\u83dc\u5355\u4e2d\uff0c\u9009\u62e9\u201cConfigure IDLE\u201d\u9009\u9879\u3002\u5728\u201cFonts\/Tabs\u201d\u9009\u9879\u5361\u4e2d\uff0c\u4f60\u53ef\u4ee5\u914d\u7f6e\u7f29\u8fdb\u7684\u65b9\u5f0f\u548c\u5927\u5c0f\u3002\u4f60\u53ef\u4ee5\u9009\u62e9\u4f7f\u7528\u7a7a\u683c\u6216\u5236\u8868\u7b26\u8fdb\u884c\u7f29\u8fdb\u3002<\/p>\n<\/p>\n<p><h2>\u516b\u3001\u5e38\u89c1\u95ee\u9898\u89e3\u51b3<\/h2>\n<\/p>\n<p><p>\u5728\u4f7f\u7528IDLE\u65f6\uff0c\u4f60\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u95ee\u9898\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u95ee\u9898\u53ca\u5176\u89e3\u51b3\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<p><h3>1. IDLE\u65e0\u6cd5\u542f\u52a8<\/h3>\n<\/p>\n<p><p>\u5982\u679cIDLE\u65e0\u6cd5\u542f\u52a8\uff0c\u53ef\u80fd\u662f\u7531\u4e8e\u73af\u5883\u53d8\u91cf\u914d\u7f6e\u9519\u8bef\u3002\u786e\u4fdd\u5728\u5b89\u88c5Python\u65f6\u52fe\u9009\u4e86\u201cAdd Python to PATH\u201d\u9009\u9879\u3002\u5982\u679c\u672a\u52fe\u9009\uff0c\u53ef\u4ee5\u624b\u52a8\u5c06Python\u7684\u5b89\u88c5\u8def\u5f84\u6dfb\u52a0\u5230\u7cfb\u7edf\u7684\u73af\u5883\u53d8\u91cf\u4e2d\u3002<\/p>\n<\/p>\n<p><h3>2. \u4ee3\u7801\u6267\u884c\u7f13\u6162<\/h3>\n<\/p>\n<p><p>\u5982\u679c\u4ee3\u7801\u6267\u884c\u7f13\u6162\uff0c\u53ef\u80fd\u662f\u7531\u4e8eIDLE\u7684\u8c03\u8bd5\u5668\u5728\u540e\u53f0\u8fd0\u884c\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u5173\u95ed\u8c03\u8bd5\u5668\u6765\u63d0\u9ad8\u4ee3\u7801\u6267\u884c\u901f\u5ea6\u3002<\/p>\n<\/p>\n<p><h3>3. \u8bed\u6cd5\u9ad8\u4eae\u663e\u793a\u4e0d\u6b63\u5e38<\/h3>\n<\/p>\n<p><p>\u5982\u679c\u8bed\u6cd5\u9ad8\u4eae\u663e\u793a\u4e0d\u6b63\u5e38\uff0c\u53ef\u80fd\u662f\u7531\u4e8e\u914d\u7f6e\u6587\u4ef6\u635f\u574f\u3002\u4f60\u53ef\u4ee5\u5c1d\u8bd5\u91cd\u7f6eIDLE\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u65b9\u6cd5\u662f\u5220\u9664<code>~\/.idlerc<\/code>\u76ee\u5f55\uff08macOS\u548cLinux\uff09\u6216<code>C:\\Users\\&lt;YourUsername&gt;\\.idlerc<\/code>\u76ee\u5f55\uff08Windows\uff09\u3002<\/p>\n<\/p>\n<p><h2>\u4e5d\u3001\u4f7f\u7528IDLE\u7684\u6700\u4f73\u5b9e\u8df5<\/h2>\n<\/p>\n<p><p>\u4e3a\u4e86\u66f4\u9ad8\u6548\u5730\u4f7f\u7528IDLE\uff0c\u4ee5\u4e0b\u662f\u4e00\u4e9b\u6700\u4f73\u5b9e\u8df5\uff1a<\/p>\n<\/p>\n<p><h3>1. \u5b9a\u671f\u4fdd\u5b58\u4ee3\u7801<\/h3>\n<\/p>\n<p><p>\u5728\u7f16\u5199\u4ee3\u7801\u65f6\uff0c\u517b\u6210\u5b9a\u671f\u4fdd\u5b58\u6587\u4ef6\u7684\u4e60\u60ef\uff0c\u4ee5\u514d\u56e0\u610f\u5916\u60c5\u51b5\u4e22\u5931\u4ee3\u7801\u3002<\/p>\n<\/p>\n<p><h3>2. \u4f7f\u7528\u7248\u672c\u63a7\u5236<\/h3>\n<\/p>\n<p><p>\u5bf9\u4e8e\u8f83\u5927\u7684\u9879\u76ee\uff0c\u5efa\u8bae\u4f7f\u7528\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff08\u5982Git\uff09\u6765\u7ba1\u7406\u4ee3\u7801\u3002\u8fd9\u6837\u53ef\u4ee5\u8ddf\u8e2a\u4ee3\u7801\u7684\u53d8\u5316\uff0c\u5e76\u5728\u9700\u8981\u65f6\u6062\u590d\u5230\u4e4b\u524d\u7684\u7248\u672c\u3002<\/p>\n<\/p>\n<p><h3>3. \u5206\u6a21\u5757\u7f16\u5199\u4ee3\u7801<\/h3>\n<\/p>\n<p><p>\u5c06\u4ee3\u7801\u62c6\u5206\u6210\u591a\u4e2a\u6a21\u5757\uff0c\u6bcf\u4e2a\u6a21\u5757\u5b9e\u73b0\u7279\u5b9a\u7684\u529f\u80fd\uff0c\u8fd9\u6837\u53ef\u4ee5\u63d0\u9ad8\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u548c\u53ef\u7ef4\u62a4\u6027\u3002<\/p>\n<\/p>\n<p><h3>4. \u6ce8\u91ca\u4ee3\u7801<\/h3>\n<\/p>\n<p><p>\u5728\u4ee3\u7801\u4e2d\u6dfb\u52a0\u6ce8\u91ca\uff0c\u8bf4\u660e\u4ee3\u7801\u7684\u529f\u80fd\u548c\u903b\u8f91\uff0c\u4ee5\u4fbf\u81ea\u5df1\u548c\u4ed6\u4eba\u7406\u89e3\u4ee3\u7801\u3002<\/p>\n<\/p>\n<p><h3>5. \u5b66\u4e60\u8c03\u8bd5\u6280\u5de7<\/h3>\n<\/p>\n<p><p>\u719f\u7ec3\u638c\u63e1\u8c03\u8bd5\u5de5\u5177\u548c\u6280\u5de7\uff0c\u53ef\u4ee5\u5e2e\u52a9\u4f60\u5feb\u901f\u5b9a\u4f4d\u548c\u4fee\u590d\u4ee3\u7801\u4e2d\u7684\u9519\u8bef\u3002<\/p>\n<\/p>\n<p><h2>\u5341\u3001\u5e38\u89c1\u95ee\u9898\u793a\u4f8b<\/h2>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u4e00\u4e9b\u4f7f\u7528IDLE\u65f6\u53ef\u80fd\u4f1a\u9047\u5230\u7684\u5e38\u89c1\u95ee\u9898\u53ca\u5176\u89e3\u51b3\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<p><h3>1. \u5728IDLE\u4e2d\u65e0\u6cd5\u8f93\u5165\u4e2d\u6587<\/h3>\n<\/p>\n<p><p>\u5728Windows\u7cfb\u7edf\u4e2d\uff0cIDLE\u9ed8\u8ba4\u4f7f\u7528\u7684\u7f16\u7801\u662fASCII\uff0c\u65e0\u6cd5\u8f93\u5165\u4e2d\u6587\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u6cd5\u89e3\u51b3\uff1a<\/p>\n<\/p>\n<ul>\n<li>\n<p>\u5728\u4ee3\u7801\u6587\u4ef6\u7684\u5f00\u5934\u6dfb\u52a0\u7f16\u7801\u58f0\u660e\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># -*- coding: utf-8 -*-<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p>\u5728IDLE\u7684\u914d\u7f6e\u9009\u9879\u4e2d\uff0c\u5c06\u9ed8\u8ba4\u7f16\u7801\u8bbe\u7f6e\u4e3aUTF-8\u3002<\/p>\n<\/p>\n<\/li>\n<\/ul>\n<p><h3>2. IDLE\u63d0\u793a\u6a21\u5757\u672a\u627e\u5230<\/h3>\n<\/p>\n<p><p>\u5728IDLE\u4e2d\u8fd0\u884c\u4ee3\u7801\u65f6\uff0c\u53ef\u80fd\u4f1a\u63d0\u793a\u67d0\u4e9b\u6a21\u5757\u672a\u627e\u5230\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u6cd5\u89e3\u51b3\uff1a<\/p>\n<\/p>\n<ul>\n<li>\n<p>\u786e\u4fdd\u6a21\u5757\u5df2\u6b63\u786e\u5b89\u88c5\uff0c\u53ef\u4ee5\u4f7f\u7528<code>pip<\/code>\u547d\u4ee4\u5b89\u88c5\u6a21\u5757\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip install \u6a21\u5757\u540d<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p>\u786e\u4fdd\u6a21\u5757\u8def\u5f84\u6b63\u786e\uff0c\u53ef\u4ee5\u4f7f\u7528<code>sys.path<\/code>\u67e5\u770b\u5f53\u524d\u7684\u6a21\u5757\u641c\u7d22\u8def\u5f84\uff0c\u5e76\u5c06\u6a21\u5757\u6240\u5728\u76ee\u5f55\u6dfb\u52a0\u5230<code>sys.path<\/code>\u4e2d\u3002<\/p>\n<\/p>\n<\/li>\n<\/ul>\n<p><h3>3. IDLE\u663e\u793a\u4e71\u7801<\/h3>\n<\/p>\n<p><p>\u5728Windows\u7cfb\u7edf\u4e2d\uff0cIDLE\u53ef\u80fd\u4f1a\u663e\u793a\u4e71\u7801\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u6cd5\u89e3\u51b3\uff1a<\/p>\n<\/p>\n<ul>\n<li>\n<p>\u5728\u4ee3\u7801\u6587\u4ef6\u7684\u5f00\u5934\u6dfb\u52a0\u7f16\u7801\u58f0\u660e\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># -*- coding: utf-8 -*-<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p>\u5728IDLE\u7684\u914d\u7f6e\u9009\u9879\u4e2d\uff0c\u5c06\u9ed8\u8ba4\u7f16\u7801\u8bbe\u7f6e\u4e3aUTF-8\u3002<\/p>\n<\/p>\n<\/li>\n<\/ul>\n<p><h3>4. IDLE\u65e0\u6cd5\u8fd0\u884cPython 2.x\u4ee3\u7801<\/h3>\n<\/p>\n<p><p>IDLE\u9ed8\u8ba4\u4f7f\u7528\u7684\u662fPython 3.x\uff0c\u5982\u679c\u9700\u8981\u8fd0\u884cPython 2.x\u4ee3\u7801\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u5b89\u88c5Python 2.x\uff0c\u5e76\u786e\u4fdd\u5728\u5b89\u88c5\u65f6\u52fe\u9009\u4e86\u201cAdd Python to PATH\u201d\u9009\u9879\u3002<\/li>\n<li>\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165<code>idle2<\/code>\u547d\u4ee4\uff0c\u542f\u52a8Python 2.x\u7248\u672c\u7684IDLE\u3002<\/li>\n<\/ul>\n<p><h3>5. IDLE\u65e0\u6cd5\u8fd0\u884c\u5e26\u56fe\u5f62\u754c\u9762\u7684\u7a0b\u5e8f<\/h3>\n<\/p>\n<p><p>\u5728IDLE\u4e2d\u8fd0\u884c\u5e26\u56fe\u5f62\u754c\u9762\u7684\u7a0b\u5e8f\u65f6\uff0c\u53ef\u80fd\u4f1a\u51fa\u73b0\u65e0\u6cd5\u663e\u793a\u56fe\u5f62\u754c\u9762\u7684\u60c5\u51b5\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u6cd5\u89e3\u51b3\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u4f7f\u7528\u547d\u4ee4\u884c\u8fd0\u884c\u5e26\u56fe\u5f62\u754c\u9762\u7684\u7a0b\u5e8f\uff0c\u800c\u4e0d\u662f\u5728IDLE\u4e2d\u8fd0\u884c\u3002<\/li>\n<li>\u786e\u4fdd\u56fe\u5f62\u754c\u9762\u5e93\u5df2\u6b63\u786e\u5b89\u88c5\uff0c\u5e76\u4e14\u517c\u5bb9\u5f53\u524d\u7684Python\u7248\u672c\u3002<\/li>\n<\/ul>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u7684\u4ecb\u7ecd\uff0c\u76f8\u4fe1\u4f60\u5df2\u7ecf\u638c\u63e1\u4e86\u5982\u4f55\u5728Python\u4e2d\u4f7f\u7528IDLE\u7684\u57fa\u672c\u65b9\u6cd5\u548c\u6280\u5de7\u3002IDLE\u662f\u4e00\u4e2a\u975e\u5e38\u6709\u7528\u7684\u5de5\u5177\uff0c\u9002\u5408\u521d\u5b66\u8005\u548c\u4e2d\u7ea7\u7528\u6237\u4f7f\u7528\uff0c\u53ef\u4ee5\u5e2e\u52a9\u4f60\u5feb\u901f\u7f16\u5199\u3001\u8c03\u8bd5\u548c\u8fd0\u884cPython\u4ee3\u7801\u3002\u5e0c\u671b\u8fd9\u4e9b\u5185\u5bb9\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff0c\u795d\u4f60\u5728Python\u7f16\u7a0b\u7684\u9053\u8def\u4e0a\u53d6\u5f97\u66f4\u5927\u7684\u8fdb\u6b65\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u5b89\u88c5\u548c\u8fd0\u884cIDLE\uff1f<\/strong><br \/>\u8981\u5728Python\u4e2d\u4f7f\u7528IDLE\uff0c\u9996\u5148\u9700\u8981\u786e\u4fdd\u5df2\u5b89\u88c5Python\u3002IDLE\u901a\u5e38\u4e0ePython\u4e00\u8d77\u5b89\u88c5\u3002\u5982\u679c\u4f60\u662fWindows\u7528\u6237\uff0c\u53ef\u4ee5\u5728\u5f00\u59cb\u83dc\u5355\u4e2d\u641c\u7d22\u201cIDLE\u201d\u3002\u5bf9\u4e8emacOS\u548cLinux\u7528\u6237\uff0c\u53ef\u4ee5\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165<code>idle<\/code>\u6765\u542f\u52a8\u3002\u786e\u4fdd\u4f60\u7684PATH\u73af\u5883\u53d8\u91cf\u6b63\u786e\u914d\u7f6e\uff0c\u4ee5\u4fbf\u5728\u547d\u4ee4\u884c\u4e2d\u65b9\u4fbf\u5730\u8bbf\u95eeIDLE\u3002<\/p>\n<p><strong>IDLE\u7684\u4e3b\u8981\u529f\u80fd\u548c\u7279\u70b9\u662f\u4ec0\u4e48\uff1f<\/strong><br \/>IDLE\u662fPython\u7684\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff0c\u63d0\u4f9b\u4e86\u7b80\u5355\u7684\u4ee3\u7801\u7f16\u8f91\u3001\u8c03\u8bd5\u548c\u6267\u884c\u529f\u80fd\u3002\u5b83\u7684\u4e3b\u8981\u7279\u70b9\u5305\u62ec\u8bed\u6cd5\u9ad8\u4eae\u3001\u81ea\u52a8\u7f29\u8fdb\u3001\u4ea4\u4e92\u5f0f\u89e3\u91ca\u5668\u3001\u8c03\u8bd5\u5668\u548c\u4ee3\u7801\u8865\u5168\u7b49\u529f\u80fd\uff0c\u975e\u5e38\u9002\u5408\u521d\u5b66\u8005\u8fdb\u884cPython\u7f16\u7a0b\u3002\u901a\u8fc7IDLE\uff0c\u7528\u6237\u53ef\u4ee5\u8f7b\u677e\u64b0\u5199\u548c\u6d4b\u8bd5Python\u4ee3\u7801\uff0c\u800c\u65e0\u9700\u4f7f\u7528\u590d\u6742\u7684IDE\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728IDLE\u4e2d\u8c03\u8bd5Python\u4ee3\u7801\uff1f<\/strong><br \/>\u5728IDLE\u4e2d\u8c03\u8bd5\u4ee3\u7801\u975e\u5e38\u7b80\u5355\u3002\u7528\u6237\u53ef\u4ee5\u4f7f\u7528\u5185\u7f6e\u7684\u8c03\u8bd5\u5668\uff0c\u9009\u62e9\u201cDebug\u201d\u83dc\u5355\uff0c\u7136\u540e\u70b9\u51fb\u201cDebugger\u201d\u6765\u542f\u52a8\u8c03\u8bd5\u754c\u9762\u3002\u6b64\u65f6\uff0c\u53ef\u4ee5\u8bbe\u7f6e\u65ad\u70b9\u5e76\u9010\u884c\u6267\u884c\u4ee3\u7801\uff0c\u4ee5\u67e5\u770b\u53d8\u91cf\u7684\u503c\u548c\u7a0b\u5e8f\u7684\u6267\u884c\u6d41\u7a0b\u3002\u8fd9\u79cd\u9010\u6b65\u8c03\u8bd5\u7684\u65b9\u5f0f\u5e2e\u52a9\u7528\u6237\u66f4\u597d\u5730\u7406\u89e3\u4ee3\u7801\u7684\u8fd0\u884c\u903b\u8f91\u548c\u53d1\u73b0\u6f5c\u5728\u9519\u8bef\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Python\u4e2d\u4f7f\u7528IDLE\uff08Integrated Development and Learning Envi [&hellip;]","protected":false},"author":3,"featured_media":1158577,"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\/1158572"}],"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=1158572"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1158572\/revisions"}],"predecessor-version":[{"id":1158578,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1158572\/revisions\/1158578"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1158577"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1158572"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1158572"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1158572"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}