{"id":1160351,"date":"2025-01-13T19:03:50","date_gmt":"2025-01-13T11:03:50","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1160351.html"},"modified":"2025-01-13T19:03:52","modified_gmt":"2025-01-13T11:03:52","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8idea%e9%85%8d%e7%bd%aepython%e8%bf%90%e8%a1%8c","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1160351.html","title":{"rendered":"\u5982\u4f55\u5728idea\u914d\u7f6epython\u8fd0\u884c"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25201832\/82348c55-2318-43f9-a67a-ad59b00bb8d8.webp\" alt=\"\u5982\u4f55\u5728idea\u914d\u7f6epython\u8fd0\u884c\" \/><\/p>\n<p><p> <strong>\u5728IDEA\u914d\u7f6ePython\u8fd0\u884c\u65f6\u9700\u8981\u8fdb\u884c\u4ee5\u4e0b\u51e0\u4e2a\u6b65\u9aa4<\/strong>\uff1a\u5b89\u88c5Python\u89e3\u91ca\u5668\u3001\u5b89\u88c5\u548c\u914d\u7f6ePyCharm\u63d2\u4ef6\u3001\u521b\u5efaPython\u9879\u76ee\u3001\u914d\u7f6e\u8fd0\u884c\u73af\u5883\u3002\u4e0b\u9762\u5c06\u8be6\u7ec6\u63cf\u8ff0\u5176\u4e2d\u4e00\u4e2a\u6b65\u9aa4\uff1a<strong>\u5b89\u88c5\u548c\u914d\u7f6ePyCharm\u63d2\u4ef6<\/strong>\u3002PyCharm\u63d2\u4ef6\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\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\uff0c\u5b83\u53ef\u4ee5\u5e2e\u52a9\u5f00\u53d1\u8005\u5728IntelliJ IDEA\u4e2d\u7f16\u5199\u3001\u8c03\u8bd5\u548c\u8fd0\u884cPython\u4ee3\u7801\u3002\u901a\u8fc7\u5b89\u88c5\u548c\u914d\u7f6ePyCharm\u63d2\u4ef6\uff0c\u60a8\u53ef\u4ee5\u5728IDEA\u4e2d\u4eab\u53d7\u4e0ePyCharm\u76f8\u540c\u7684\u529f\u80fd\u548c\u4f53\u9a8c\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u5b89\u88c5Python\u89e3\u91ca\u5668<\/h3>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4e0b\u8f7dPython<\/strong>\uff1a\u9996\u5148\uff0c\u60a8\u9700\u8981\u4ecePython\u5b98\u65b9\u7f51\u7ad9\uff08<a href=\"https:\/\/www.python.org\/%EF%BC%89%E4%B8%8B%E8%BD%BD%E6%9C%80%E6%96%B0%E7%89%88%E6%9C%AC%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%EF%BC%88Windows%E3%80%81MacOS%E6%88%96Linux%EF%BC%89%E3%80%82\">https:\/\/www.python.org\/\uff09\u4e0b\u8f7d\u6700\u65b0\u7248\u672c\u7684Python\u5b89\u88c5\u5305\u3002\u9009\u62e9\u9002\u5408\u60a8\u64cd\u4f5c\u7cfb\u7edf\u7684\u7248\u672c\uff08Windows\u3001MacOS\u6216Linux\uff09\u3002<\/a><\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5Python<\/strong>\uff1a\u8fd0\u884c\u4e0b\u8f7d\u7684\u5b89\u88c5\u5305\uff0c\u6839\u636e\u63d0\u793a\u8fdb\u884c\u5b89\u88c5\u3002\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u786e\u4fdd\u9009\u4e2d\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u8fd9\u6837\u53ef\u4ee5\u786e\u4fddPython\u53ef\u6267\u884c\u6587\u4ef6\u80fd\u591f\u5728\u547d\u4ee4\u884c\u4e2d\u88ab\u627e\u5230\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u9a8c\u8bc1\u5b89\u88c5<\/strong>\uff1a\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6253\u5f00\u547d\u4ee4\u884c\u7a97\u53e3\uff08Windows\u4e0b\u4e3acmd\uff0cMacOS\u548cLinux\u4e0b\u4e3aTerminal\uff09\uff0c\u8f93\u5165<code>python --version<\/code>\u6216<code>python3 --version<\/code>\uff0c\u5982\u679c\u6b63\u786e\u663e\u793aPython\u7248\u672c\u53f7\uff0c\u5219\u8bf4\u660e\u5b89\u88c5\u6210\u529f\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u4e8c\u3001\u5b89\u88c5\u548c\u914d\u7f6ePyCharm\u63d2\u4ef6<\/h3>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6253\u5f00IntelliJ IDEA<\/strong>\uff1a\u542f\u52a8IntelliJ IDEA\uff0c\u5728\u4e3b\u754c\u9762\u4e0a\u9009\u62e9\u201cFile\u201d -&gt; \u201cSettings\u201d (Windows\u548cLinux) \u6216\u201cIntelliJ IDEA\u201d -&gt; \u201cPreferences\u201d (MacOS)\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5PyCharm\u63d2\u4ef6<\/strong>\uff1a\u5728\u8bbe\u7f6e\u754c\u9762\u4e2d\uff0c\u9009\u62e9\u201cPlugins\u201d\u9009\u9879\u5361\u3002\u5728\u53f3\u4e0a\u89d2\u7684\u641c\u7d22\u6846\u4e2d\u8f93\u5165\u201cPython\u201d\uff0c\u627e\u5230\u201cPython\u201d\u63d2\u4ef6\uff0c\u70b9\u51fb\u201cInstall\u201d\u8fdb\u884c\u5b89\u88c5\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u91cd\u542fIDEA\u4ee5\u4f7f\u63d2\u4ef6\u751f\u6548\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u914d\u7f6ePython SDK<\/strong>\uff1a\u91cd\u542fIDEA\u540e\uff0c\u6253\u5f00\u4e00\u4e2a\u73b0\u6709\u9879\u76ee\u6216\u521b\u5efa\u4e00\u4e2a\u65b0\u9879\u76ee\u3002\u5728\u9879\u76ee\u7ed3\u6784\u7a97\u53e3\u4e2d\uff0c\u9009\u62e9\u201cFile\u201d -&gt; \u201cProject Structure\u201d\uff0c\u7136\u540e\u9009\u62e9\u201cProject Settings\u201d -&gt; \u201cProject\u201d\u3002\u5728\u201cProject SDK\u201d\u4e0b\u62c9\u83dc\u5355\u4e2d\uff0c\u9009\u62e9\u201cAdd SDK\u201d -&gt; \u201cPython SDK\u201d\uff0c\u7136\u540e\u9009\u62e9\u5df2\u5b89\u88c5\u7684Python\u89e3\u91ca\u5668\u8def\u5f84\u3002\u70b9\u51fb\u201cApply\u201d\u4fdd\u5b58\u8bbe\u7f6e\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u4e09\u3001\u521b\u5efaPython\u9879\u76ee<\/h3>\n<\/p>\n<ol>\n<li>\n<p><strong>\u521b\u5efa\u65b0\u9879\u76ee<\/strong>\uff1a\u5728IDEA\u4e3b\u754c\u9762\u4e0a\uff0c\u9009\u62e9\u201cFile\u201d -&gt; \u201cNew\u201d -&gt; \u201cProject\u201d\u3002\u5728\u5f39\u51fa\u7684\u65b0\u9879\u76ee\u5411\u5bfc\u4e2d\uff0c\u9009\u62e9\u201cPython\u201d\u4f5c\u4e3a\u9879\u76ee\u7c7b\u578b\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8bbe\u7f6e\u9879\u76ee\u4f4d\u7f6e<\/strong>\uff1a\u5728\u201cLocation\u201d\u5b57\u6bb5\u4e2d\uff0c\u8f93\u5165\u9879\u76ee\u7684\u5b58\u653e\u8def\u5f84\u3002\u70b9\u51fb\u201cNext\u201d\u7ee7\u7eed\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u9009\u62e9\u9879\u76ee\u89e3\u91ca\u5668<\/strong>\uff1a\u5728\u201cProject Interpreter\u201d\u4e0b\u62c9\u83dc\u5355\u4e2d\uff0c\u9009\u62e9\u4e4b\u524d\u914d\u7f6e\u597d\u7684Python\u89e3\u91ca\u5668\u3002\u70b9\u51fb\u201cCreate\u201d\u521b\u5efa\u9879\u76ee\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u521b\u5efaPython\u6587\u4ef6<\/strong>\uff1a\u5728\u9879\u76ee\u7a97\u53e3\u4e2d\uff0c\u53f3\u952e\u70b9\u51fb\u9879\u76ee\u540d\u79f0\uff0c\u9009\u62e9\u201cNew\u201d -&gt; \u201cPython File\u201d\u3002\u8f93\u5165\u6587\u4ef6\u540d\u79f0\u540e\uff0c\u70b9\u51fb\u201cOK\u201d\u521b\u5efaPython\u6587\u4ef6\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u56db\u3001\u914d\u7f6e\u8fd0\u884c\u73af\u5883<\/h3>\n<\/p>\n<ol>\n<li>\n<p><strong>\u521b\u5efa\u8fd0\u884c\u914d\u7f6e<\/strong>\uff1a\u5728IDEA\u4e3b\u754c\u9762\u4e0a\uff0c\u9009\u62e9\u201cRun\u201d -&gt; \u201cEdit Configurations\u201d\u3002\u5728\u5f39\u51fa\u7684\u8fd0\u884c\u914d\u7f6e\u7a97\u53e3\u4e2d\uff0c\u70b9\u51fb\u5de6\u4e0a\u89d2\u7684\u201c+\u201d\u53f7\uff0c\u9009\u62e9\u201cPython\u201d\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8bbe\u7f6e\u811a\u672c\u8def\u5f84<\/strong>\uff1a\u5728\u201cScript path\u201d\u5b57\u6bb5\u4e2d\uff0c\u8f93\u5165\u6216\u9009\u62e9\u8981\u8fd0\u884c\u7684Python\u811a\u672c\u6587\u4ef6\u8def\u5f84\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8bbe\u7f6e\u5de5\u4f5c\u76ee\u5f55<\/strong>\uff1a\u5728\u201cWorking directory\u201d\u5b57\u6bb5\u4e2d\uff0c\u8f93\u5165\u6216\u9009\u62e9\u9879\u76ee\u7684\u6839\u76ee\u5f55\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<\/strong>\uff1a\u5982\u679c\u9700\u8981\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\uff0c\u53ef\u4ee5\u5728\u201cEnvironment variables\u201d\u5b57\u6bb5\u4e2d\u6dfb\u52a0\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4fdd\u5b58\u914d\u7f6e<\/strong>\uff1a\u70b9\u51fb\u201cOK\u201d\u4fdd\u5b58\u8fd0\u884c\u914d\u7f6e\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8fd0\u884cPython\u811a\u672c<\/strong>\uff1a\u5728IDEA\u4e3b\u754c\u9762\u4e0a\uff0c\u70b9\u51fb\u53f3\u4e0a\u89d2\u7684\u8fd0\u884c\u6309\u94ae\uff0c\u9009\u62e9\u521a\u521a\u521b\u5efa\u7684\u8fd0\u884c\u914d\u7f6e\uff0c\u70b9\u51fb\u201cRun\u201d\u8fd0\u884cPython\u811a\u672c\u3002\u53ef\u4ee5\u5728\u4e0b\u65b9\u7684\u8fd0\u884c\u7a97\u53e3\u4e2d\u67e5\u770b\u8fd0\u884c\u7ed3\u679c\u548c\u8f93\u51fa\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u4e94\u3001\u8c03\u8bd5Python\u4ee3\u7801<\/h3>\n<\/p>\n<ol>\n<li>\n<p><strong>\u8bbe\u7f6e\u65ad\u70b9<\/strong>\uff1a\u5728Python\u6587\u4ef6\u4e2d\uff0c\u70b9\u51fb\u884c\u53f7\u5de6\u4fa7\u7684\u7a7a\u767d\u533a\u57df\uff0c\u8bbe\u7f6e\u65ad\u70b9\u3002\u65ad\u70b9\u53ef\u4ee5\u8ba9\u7a0b\u5e8f\u5728\u8fd0\u884c\u5230\u6307\u5b9a\u4f4d\u7f6e\u65f6\u6682\u505c\uff0c\u65b9\u4fbf\u8c03\u8bd5\u548c\u67e5\u770b\u53d8\u91cf\u503c\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u542f\u52a8\u8c03\u8bd5\u6a21\u5f0f<\/strong>\uff1a\u5728IDEA\u4e3b\u754c\u9762\u4e0a\uff0c\u70b9\u51fb\u53f3\u4e0a\u89d2\u7684\u8c03\u8bd5\u6309\u94ae\uff0c\u9009\u62e9\u521b\u5efa\u597d\u7684\u8fd0\u884c\u914d\u7f6e\uff0c\u70b9\u51fb\u201cDebug\u201d\u542f\u52a8\u8c03\u8bd5\u6a21\u5f0f\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u67e5\u770b\u53d8\u91cf\u503c<\/strong>\uff1a\u5728\u8c03\u8bd5\u7a97\u53e3\u4e2d\uff0c\u53ef\u4ee5\u67e5\u770b\u5f53\u524d\u53d8\u91cf\u7684\u503c\u3001\u8c03\u7528\u6808\u548c\u63a7\u5236\u53f0\u8f93\u51fa\u3002\u53ef\u4ee5\u901a\u8fc7\u5355\u6b65\u6267\u884c\u3001\u8fdb\u5165\u51fd\u6570\u3001\u8df3\u8fc7\u51fd\u6570\u7b49\u64cd\u4f5c\u6765\u9010\u6b65\u8c03\u8bd5\u4ee3\u7801\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4fee\u6539\u53d8\u91cf\u503c<\/strong>\uff1a\u5728\u8c03\u8bd5\u8fc7\u7a0b\u4e2d\uff0c\u53ef\u4ee5\u53f3\u952e\u70b9\u51fb\u53d8\u91cf\u540d\u79f0\uff0c\u9009\u62e9\u201cSet Value\u201d\u4fee\u6539\u53d8\u91cf\u7684\u503c\uff0c\u4ee5\u4fbf\u89c2\u5bdf\u4e0d\u540c\u53d8\u91cf\u503c\u5bf9\u7a0b\u5e8f\u8fd0\u884c\u7684\u5f71\u54cd\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u516d\u3001\u4f7f\u7528\u865a\u62df\u73af\u5883<\/h3>\n<\/p>\n<ol>\n<li>\n<p><strong>\u521b\u5efa\u865a\u62df\u73af\u5883<\/strong>\uff1a\u5728IDEA\u4e2d\u521b\u5efaPython\u9879\u76ee\u65f6\uff0c\u53ef\u4ee5\u9009\u62e9\u4f7f\u7528\u865a\u62df\u73af\u5883\u3002\u5728\u9879\u76ee\u89e3\u91ca\u5668\u9009\u62e9\u7a97\u53e3\u4e2d\uff0c\u9009\u62e9\u201cNew environment using\u201d -&gt; \u201cVirtualenv\u201d\uff0c\u7136\u540e\u9009\u62e9\u865a\u62df\u73af\u5883\u7684\u5b58\u653e\u8def\u5f84\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6fc0\u6d3b\u865a\u62df\u73af\u5883<\/strong>\uff1a\u5728\u521b\u5efa\u597d\u865a\u62df\u73af\u5883\u540e\uff0c\u53ef\u4ee5\u5728\u9879\u76ee\u7a97\u53e3\u4e2d\u770b\u5230\u4e00\u4e2a\u65b0\u7684\u865a\u62df\u73af\u5883\u76ee\u5f55\u3002\u5728\u547d\u4ee4\u884c\u7a97\u53e3\u4e2d\uff0c\u8fdb\u5165\u865a\u62df\u73af\u5883\u76ee\u5f55\uff0c\u8fd0\u884c<code>source venv\/bin\/activate<\/code>\uff08MacOS\u548cLinux\uff09\u6216<code>venv\\Scripts\\activate<\/code>\uff08Windows\uff09\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5\u4f9d\u8d56\u5305<\/strong>\uff1a\u5728\u865a\u62df\u73af\u5883\u6fc0\u6d3b\u72b6\u6001\u4e0b\uff0c\u53ef\u4ee5\u4f7f\u7528<code>pip<\/code>\u547d\u4ee4\u5b89\u88c5\u9879\u76ee\u6240\u9700\u7684\u4f9d\u8d56\u5305\u3002\u4f8b\u5982\uff0c<code>pip install numpy<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u914d\u7f6eIDEA\u4f7f\u7528\u865a\u62df\u73af\u5883<\/strong>\uff1a\u5728IDEA\u4e2d\uff0c\u6253\u5f00\u201cFile\u201d -&gt; \u201cProject Structure\u201d\uff0c\u9009\u62e9\u201cProject Settings\u201d -&gt; \u201cProject\u201d\uff0c\u5728\u201cProject SDK\u201d\u4e0b\u62c9\u83dc\u5355\u4e2d\u9009\u62e9\u865a\u62df\u73af\u5883\u7684Python\u89e3\u91ca\u5668\u8def\u5f84\u3002\u70b9\u51fb\u201cApply\u201d\u4fdd\u5b58\u8bbe\u7f6e\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u4e03\u3001\u4f7f\u7528\u4ee3\u7801\u68c0\u67e5\u548c\u683c\u5f0f\u5316\u5de5\u5177<\/h3>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5b89\u88c5\u4ee3\u7801\u68c0\u67e5\u5de5\u5177<\/strong>\uff1a\u5728\u865a\u62df\u73af\u5883\u6fc0\u6d3b\u72b6\u6001\u4e0b\uff0c\u53ef\u4ee5\u4f7f\u7528<code>pip<\/code>\u547d\u4ee4\u5b89\u88c5\u4ee3\u7801\u68c0\u67e5\u5de5\u5177\u3002\u4f8b\u5982\uff0c<code>pip install pylint<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u914d\u7f6e\u4ee3\u7801\u68c0\u67e5\u5de5\u5177<\/strong>\uff1a\u5728IDEA\u4e2d\uff0c\u6253\u5f00\u201cFile\u201d -&gt; \u201cSettings\u201d (Windows\u548cLinux) \u6216\u201cIntelliJ IDEA\u201d -&gt; \u201cPreferences\u201d (MacOS)\uff0c\u9009\u62e9\u201cLanguages &amp; Frameworks\u201d -&gt; \u201cPython\u201d -&gt; \u201cCode Style\u201d\u3002\u5728\u201cCode Style\u201d\u9009\u9879\u5361\u4e2d\uff0c\u9009\u62e9\u201cPylint\u201d\u4f5c\u4e3a\u4ee3\u7801\u68c0\u67e5\u5de5\u5177\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528\u4ee3\u7801\u683c\u5f0f\u5316\u5de5\u5177<\/strong>\uff1a\u5728\u865a\u62df\u73af\u5883\u6fc0\u6d3b\u72b6\u6001\u4e0b\uff0c\u53ef\u4ee5\u4f7f\u7528<code>pip<\/code>\u547d\u4ee4\u5b89\u88c5\u4ee3\u7801\u683c\u5f0f\u5316\u5de5\u5177\u3002\u4f8b\u5982\uff0c<code>pip install black<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u914d\u7f6e\u4ee3\u7801\u683c\u5f0f\u5316\u5de5\u5177<\/strong>\uff1a\u5728IDEA\u4e2d\uff0c\u6253\u5f00\u201cFile\u201d -&gt; \u201cSettings\u201d (Windows\u548cLinux) \u6216\u201cIntelliJ IDEA\u201d -&gt; \u201cPreferences\u201d (MacOS)\uff0c\u9009\u62e9\u201cLanguages &amp; Frameworks\u201d -&gt; \u201cPython\u201d -&gt; \u201cCode Style\u201d\u3002\u5728\u201cCode Style\u201d\u9009\u9879\u5361\u4e2d\uff0c\u9009\u62e9\u201cBlack\u201d\u4f5c\u4e3a\u4ee3\u7801\u683c\u5f0f\u5316\u5de5\u5177\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u81ea\u52a8\u683c\u5f0f\u5316\u4ee3\u7801<\/strong>\uff1a\u5728IDEA\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u5feb\u6377\u952e\uff08Windows\u548cLinux\u4e0b\u4e3aCtrl+Alt+L\uff0cMacOS\u4e0b\u4e3aCommand+Option+L\uff09\u81ea\u52a8\u683c\u5f0f\u5316\u4ee3\u7801\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u516b\u3001\u4f7f\u7528\u7248\u672c\u63a7\u5236\u7cfb\u7edf<\/h3>\n<\/p>\n<ol>\n<li>\n<p><strong>\u521d\u59cb\u5316Git\u4ed3\u5e93<\/strong>\uff1a\u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\uff0c\u8fd0\u884c<code>git init<\/code>\u547d\u4ee4\u521d\u59cb\u5316Git\u4ed3\u5e93\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u521b\u5efa<code>.gitignore<\/code>\u6587\u4ef6<\/strong>\uff1a\u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\u521b\u5efa<code>.gitignore<\/code>\u6587\u4ef6\uff0c\u5e76\u6dfb\u52a0\u4e0d\u9700\u8981\u7eb3\u5165\u7248\u672c\u63a7\u5236\u7684\u6587\u4ef6\u548c\u76ee\u5f55\uff0c\u4f8b\u5982\u865a\u62df\u73af\u5883\u76ee\u5f55\u3001\u7f16\u8bd1\u751f\u6210\u7684\u6587\u4ef6\u7b49\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u63d0\u4ea4\u4ee3\u7801<\/strong>\uff1a\u5728IDEA\u4e2d\uff0c\u6253\u5f00\u201cVCS\u201d -&gt; \u201cImport into Version Control\u201d -&gt; \u201cCreate Git Repository\u201d\u9009\u62e9\u9879\u76ee\u6839\u76ee\u5f55\uff0c\u70b9\u51fb\u201cOK\u201d\u521b\u5efaGit\u4ed3\u5e93\u3002\u7136\u540e\u5728\u9879\u76ee\u7a97\u53e3\u4e2d\u53f3\u952e\u70b9\u51fb\u6587\u4ef6\u6216\u76ee\u5f55\uff0c\u9009\u62e9\u201cGit\u201d -&gt; \u201cAdd\u201d\u5c06\u6587\u4ef6\u6216\u76ee\u5f55\u6dfb\u52a0\u5230\u7248\u672c\u63a7\u5236\u4e2d\u3002\u6700\u540e\u5728\u201cVCS\u201d -&gt; \u201cCommit\u201d\u7a97\u53e3\u4e2d\uff0c\u586b\u5199\u63d0\u4ea4\u4fe1\u606f\uff0c\u70b9\u51fb\u201cCommit\u201d\u63d0\u4ea4\u4ee3\u7801\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u63a8\u9001\u4ee3\u7801\u5230\u8fdc\u7a0b\u4ed3\u5e93<\/strong>\uff1a\u5728IDEA\u4e2d\uff0c\u6253\u5f00\u201cVCS\u201d -&gt; \u201cGit\u201d -&gt; \u201cPush\u201d\u7a97\u53e3\uff0c\u9009\u62e9\u8fdc\u7a0b\u4ed3\u5e93\u5730\u5740\uff0c\u70b9\u51fb\u201cPush\u201d\u63a8\u9001\u4ee3\u7801\u5230\u8fdc\u7a0b\u4ed3\u5e93\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u4e5d\u3001\u4f7f\u7528\u6d4b\u8bd5\u6846\u67b6<\/h3>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5b89\u88c5\u6d4b\u8bd5\u6846\u67b6<\/strong>\uff1a\u5728\u865a\u62df\u73af\u5883\u6fc0\u6d3b\u72b6\u6001\u4e0b\uff0c\u53ef\u4ee5\u4f7f\u7528<code>pip<\/code>\u547d\u4ee4\u5b89\u88c5\u6d4b\u8bd5\u6846\u67b6\u3002\u4f8b\u5982\uff0c<code>pip install pytest<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7f16\u5199\u6d4b\u8bd5\u7528\u4f8b<\/strong>\uff1a\u5728\u9879\u76ee\u76ee\u5f55\u4e2d\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u6d4b\u8bd5\u6587\u4ef6\uff0c\u6587\u4ef6\u540d\u4ee5<code>test_<\/code>\u5f00\u5934\u3002\u5728\u6d4b\u8bd5\u6587\u4ef6\u4e2d\u7f16\u5199\u6d4b\u8bd5\u7528\u4f8b\uff0c\u4f7f\u7528<code>pytest<\/code>\u6846\u67b6\u7684\u65ad\u8a00\u8bed\u53e5\u8fdb\u884c\u6d4b\u8bd5\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8fd0\u884c\u6d4b\u8bd5\u7528\u4f8b<\/strong>\uff1a\u5728IDEA\u4e2d\uff0c\u53f3\u952e\u70b9\u51fb\u6d4b\u8bd5\u6587\u4ef6\u6216\u76ee\u5f55\uff0c\u9009\u62e9\u201cRun &#39;pytest in &#8230;&#39;\u201d\u8fd0\u884c\u6d4b\u8bd5\u7528\u4f8b\u3002\u5728\u8fd0\u884c\u7a97\u53e3\u4e2d\u53ef\u4ee5\u67e5\u770b\u6d4b\u8bd5\u7ed3\u679c\u548c\u8f93\u51fa\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u914d\u7f6e\u6d4b\u8bd5\u6846\u67b6<\/strong>\uff1a\u5728IDEA\u4e2d\uff0c\u6253\u5f00\u201cFile\u201d -&gt; \u201cSettings\u201d (Windows\u548cLinux) \u6216\u201cIntelliJ IDEA\u201d -&gt; \u201cPreferences\u201d (MacOS)\uff0c\u9009\u62e9\u201cLanguages &amp; Frameworks\u201d -&gt; \u201cPython\u201d -&gt; \u201cTesting\u201d\u3002\u5728\u201cTesting\u201d\u9009\u9879\u5361\u4e2d\uff0c\u9009\u62e9\u201cpytest\u201d\u4f5c\u4e3a\u6d4b\u8bd5\u6846\u67b6\uff0c\u5e76\u914d\u7f6e\u76f8\u5173\u53c2\u6570\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u5341\u3001\u4f7f\u7528\u6587\u6863\u751f\u6210\u5de5\u5177<\/h3>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5b89\u88c5\u6587\u6863\u751f\u6210\u5de5\u5177<\/strong>\uff1a\u5728\u865a\u62df\u73af\u5883\u6fc0\u6d3b\u72b6\u6001\u4e0b\uff0c\u53ef\u4ee5\u4f7f\u7528<code>pip<\/code>\u547d\u4ee4\u5b89\u88c5\u6587\u6863\u751f\u6210\u5de5\u5177\u3002\u4f8b\u5982\uff0c<code>pip install sphinx<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u521d\u59cb\u5316Sphinx\u9879\u76ee<\/strong>\uff1a\u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\uff0c\u8fd0\u884c<code>sphinx-quickstart<\/code>\u547d\u4ee4\uff0c\u6839\u636e\u63d0\u793a\u521d\u59cb\u5316Sphinx\u9879\u76ee\u3002\u751f\u6210\u7684\u914d\u7f6e\u6587\u4ef6\u548c\u76ee\u5f55\u7ed3\u6784\u5c06\u7528\u4e8e\u751f\u6210\u9879\u76ee\u6587\u6863\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7f16\u5199\u6587\u6863<\/strong>\uff1a\u5728Sphinx\u9879\u76ee\u76ee\u5f55\u4e2d\uff0c\u7f16\u8f91<code>index.rst<\/code>\u6587\u4ef6\u548c\u5176\u4ed6\u6587\u6863\u6587\u4ef6\uff0c\u4f7f\u7528reStructuredText\u683c\u5f0f\u7f16\u5199\u9879\u76ee\u6587\u6863\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u751f\u6210HTML\u6587\u6863<\/strong>\uff1a\u5728Sphinx\u9879\u76ee\u76ee\u5f55\u4e0b\uff0c\u8fd0\u884c<code>make html<\/code>\u547d\u4ee4\u751f\u6210HTML\u683c\u5f0f\u7684\u9879\u76ee\u6587\u6863\u3002\u751f\u6210\u7684HTML\u6587\u4ef6\u5c06\u4fdd\u5b58\u5728<code>_build\/html<\/code>\u76ee\u5f55\u4e2d\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u67e5\u770b\u751f\u6210\u7684\u6587\u6863<\/strong>\uff1a\u5728\u6d4f\u89c8\u5668\u4e2d\u6253\u5f00\u751f\u6210\u7684HTML\u6587\u4ef6\uff0c\u67e5\u770b\u9879\u76ee\u6587\u6863\u7684\u6548\u679c\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u5341\u4e00\u3001\u4f7f\u7528\u4ee3\u7801\u5206\u6790\u5de5\u5177<\/h3>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5b89\u88c5\u4ee3\u7801\u5206\u6790\u5de5\u5177<\/strong>\uff1a\u5728\u865a\u62df\u73af\u5883\u6fc0\u6d3b\u72b6\u6001\u4e0b\uff0c\u53ef\u4ee5\u4f7f\u7528<code>pip<\/code>\u547d\u4ee4\u5b89\u88c5\u4ee3\u7801\u5206\u6790\u5de5\u5177\u3002\u4f8b\u5982\uff0c<code>pip install mypy<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7f16\u5199\u7c7b\u578b\u6ce8\u89e3<\/strong>\uff1a\u5728Python\u4ee3\u7801\u4e2d\uff0c\u4f7f\u7528\u7c7b\u578b\u6ce8\u89e3\u4e3a\u51fd\u6570\u53c2\u6570\u548c\u8fd4\u56de\u503c\u6dfb\u52a0\u7c7b\u578b\u8bf4\u660e\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def add(a: int, b: int) -&gt; int:<\/p>\n<p>    return a + b<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8fd0\u884c\u4ee3\u7801\u5206\u6790<\/strong>\uff1a\u5728\u547d\u4ee4\u884c\u7a97\u53e3\u4e2d\uff0c\u8fdb\u5165\u9879\u76ee\u76ee\u5f55\uff0c\u8fd0\u884c<code>mypy .<\/code>\u547d\u4ee4\u8fdb\u884c\u4ee3\u7801\u5206\u6790\u3002\u5206\u6790\u7ed3\u679c\u5c06\u663e\u793a\u4ee3\u7801\u4e2d\u7684\u7c7b\u578b\u9519\u8bef\u548c\u6f5c\u5728\u95ee\u9898\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u914d\u7f6eIDEA\u4f7f\u7528\u4ee3\u7801\u5206\u6790\u5de5\u5177<\/strong>\uff1a\u5728IDEA\u4e2d\uff0c\u6253\u5f00\u201cFile\u201d -&gt; \u201cSettings\u201d (Windows\u548cLinux) \u6216\u201cIntelliJ IDEA\u201d -&gt; \u201cPreferences\u201d (MacOS)\uff0c\u9009\u62e9\u201cLanguages &amp; Frameworks\u201d -&gt; \u201cPython\u201d -&gt; \u201cType Hinting\u201d\u3002\u5728\u201cType Hinting\u201d\u9009\u9879\u5361\u4e2d\uff0c\u9009\u62e9\u201cMypy\u201d\u4f5c\u4e3a\u4ee3\u7801\u5206\u6790\u5de5\u5177\uff0c\u5e76\u914d\u7f6e\u76f8\u5173\u53c2\u6570\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u5341\u4e8c\u3001\u4f7f\u7528\u4f9d\u8d56\u7ba1\u7406\u5de5\u5177<\/h3>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5b89\u88c5\u4f9d\u8d56\u7ba1\u7406\u5de5\u5177<\/strong>\uff1a\u5728\u865a\u62df\u73af\u5883\u6fc0\u6d3b\u72b6\u6001\u4e0b\uff0c\u53ef\u4ee5\u4f7f\u7528<code>pip<\/code>\u547d\u4ee4\u5b89\u88c5\u4f9d\u8d56\u7ba1\u7406\u5de5\u5177\u3002\u4f8b\u5982\uff0c<code>pip install pipenv<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u521d\u59cb\u5316Pipenv\u9879\u76ee<\/strong>\uff1a\u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\uff0c\u8fd0\u884c<code>pipenv install<\/code>\u547d\u4ee4\u521d\u59cb\u5316Pipenv\u9879\u76ee\u3002\u751f\u6210\u7684<code>Pipfile<\/code>\u548c<code>Pipfile.lock<\/code>\u6587\u4ef6\u5c06\u7528\u4e8e\u7ba1\u7406\u9879\u76ee\u4f9d\u8d56\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5\u4f9d\u8d56\u5305<\/strong>\uff1a\u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\uff0c\u8fd0\u884c<code>pipenv install &lt;package_name&gt;<\/code>\u547d\u4ee4\u5b89\u88c5\u9879\u76ee\u6240\u9700\u7684\u4f9d\u8d56\u5305\u3002\u4f8b\u5982\uff0c<code>pipenv install requests<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6fc0\u6d3bPipenv\u865a\u62df\u73af\u5883<\/strong>\uff1a\u5728\u547d\u4ee4\u884c\u7a97\u53e3\u4e2d\uff0c\u8fdb\u5165\u9879\u76ee\u76ee\u5f55\uff0c\u8fd0\u884c<code>pipenv shell<\/code>\u547d\u4ee4\u6fc0\u6d3bPipenv\u865a\u62df\u73af\u5883\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u914d\u7f6eIDEA\u4f7f\u7528Pipenv\u865a\u62df\u73af\u5883<\/strong>\uff1a\u5728IDEA\u4e2d\uff0c\u6253\u5f00\u201cFile\u201d -&gt; \u201cProject Structure\u201d\uff0c\u9009\u62e9\u201cProject Settings\u201d -&gt; \u201cProject\u201d\u3002\u5728\u201cProject SDK\u201d\u4e0b\u62c9\u83dc\u5355\u4e2d\u9009\u62e9Pipenv\u865a\u62df\u73af\u5883\u7684Python\u89e3\u91ca\u5668\u8def\u5f84\u3002\u70b9\u51fb\u201cApply\u201d\u4fdd\u5b58\u8bbe\u7f6e\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u5341\u4e09\u3001\u4f7f\u7528\u8fdc\u7a0b\u5f00\u53d1\u73af\u5883<\/h3>\n<\/p>\n<ol>\n<li>\n<p><strong>\u914d\u7f6e\u8fdc\u7a0b\u670d\u52a1\u5668<\/strong>\uff1a\u5728\u8fdc\u7a0b\u670d\u52a1\u5668\u4e0a\u5b89\u88c5Python\u73af\u5883\u548c\u6240\u9700\u7684\u4f9d\u8d56\u5305\u3002\u53ef\u4ee5\u4f7f\u7528SSH\u8fde\u63a5\u5230\u8fdc\u7a0b\u670d\u52a1\u5668\u8fdb\u884c\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u914d\u7f6eIDEA\u8fdc\u7a0b\u5f00\u53d1\u73af\u5883<\/strong>\uff1a\u5728IDEA\u4e2d\uff0c\u6253\u5f00\u201cFile\u201d -&gt; \u201cSettings\u201d (Windows\u548cLinux) \u6216\u201cIntelliJ IDEA\u201d -&gt; \u201cPreferences\u201d (MacOS)\uff0c\u9009\u62e9\u201cBuild, Execution, Deployment\u201d -&gt; \u201cDeployment\u201d\u3002\u5728\u201cDeployment\u201d\u9009\u9879\u5361\u4e2d\uff0c\u70b9\u51fb\u201c+\u201d\u53f7\u6dfb\u52a0\u65b0\u7684\u8fdc\u7a0b\u670d\u52a1\u5668\u914d\u7f6e\uff0c\u9009\u62e9\u201cSFTP\u201d\u4f5c\u4e3a\u8fde\u63a5\u7c7b\u578b\uff0c\u586b\u5199\u8fdc\u7a0b\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u3001\u7528\u6237\u540d\u548c\u5bc6\u7801\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8bbe\u7f6e\u540c\u6b65\u76ee\u5f55<\/strong>\uff1a\u5728\u8fdc\u7a0b\u670d\u52a1\u5668\u914d\u7f6e\u7a97\u53e3\u4e2d\uff0c\u9009\u62e9\u201cMappings\u201d\u9009\u9879\u5361\uff0c\u8bbe\u7f6e\u672c\u5730\u9879\u76ee\u76ee\u5f55\u4e0e\u8fdc\u7a0b\u670d\u52a1\u5668\u76ee\u5f55\u7684\u6620\u5c04\u5173\u7cfb\u3002\u70b9\u51fb\u201cOK\u201d\u4fdd\u5b58\u914d\u7f6e\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4e0a\u4f20\u9879\u76ee\u6587\u4ef6<\/strong>\uff1a\u5728IDEA\u4e2d\uff0c\u53f3\u952e\u70b9\u51fb\u9879\u76ee\u76ee\u5f55\uff0c\u9009\u62e9\u201cDeployment\u201d -&gt; \u201cUpload to <remote_server_name>\u201d\u4e0a\u4f20\u9879\u76ee\u6587\u4ef6\u5230\u8fdc\u7a0b\u670d\u52a1\u5668\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8fd0\u884c\u8fdc\u7a0bPython\u811a\u672c<\/strong>\uff1a\u5728IDEA\u4e2d\uff0c\u521b\u5efa\u65b0\u7684\u8fd0\u884c\u914d\u7f6e\uff0c\u9009\u62e9\u201cPython Remote Debug\u201d\u3002\u586b\u5199\u8fdc\u7a0b\u670d\u52a1\u5668\u7684IP\u5730\u5740\u548c\u7aef\u53e3\u53f7\uff0c\u9009\u62e9\u8981\u8fd0\u884c\u7684Python\u811a\u672c\u8def\u5f84\u3002\u70b9\u51fb\u201cRun\u201d\u6309\u94ae\u8fd0\u884c\u8fdc\u7a0bPython\u811a\u672c\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u5341\u56db\u3001\u4f7f\u7528Docker\u5bb9\u5668<\/h3>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5b89\u88c5Docker<\/strong>\uff1a\u4eceDocker\u5b98\u65b9\u7f51\u7ad9\uff08<a href=\"https:\/\/www.docker.com\/%EF%BC%89%E4%B8%8B%E8%BD%BD%E5%B9%B6%E5%AE%89%E8%A3%85Docker%E3%80%82\">https:\/\/www.docker.com\/\uff09\u4e0b\u8f7d\u5e76\u5b89\u88c5Docker\u3002<\/a><\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7f16\u5199Dockerfile<\/strong>\uff1a\u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code>Dockerfile<\/code>\u7684\u6587\u4ef6\uff0c\u7f16\u5199Dockerfile\u5185\u5bb9\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-dockerfile\">FROM python:3.8-slim<\/p>\n<p>WORKDIR \/app<\/p>\n<p>COPY . \/app<\/p>\n<p>RUN pip install -r requirements.txt<\/p>\n<p>CMD [&quot;python&quot;, &quot;main.py&quot;]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6784\u5efaDocker\u955c\u50cf<\/strong>\uff1a\u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\uff0c\u8fd0\u884c<code>docker build -t &lt;image_name&gt; .<\/code>\u547d\u4ee4\u6784\u5efaDocker\u955c\u50cf\u3002\u4f8b\u5982\uff0c<code>docker build -t my_python_app .<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8fd0\u884cDocker\u5bb9\u5668<\/strong>\uff1a\u8fd0\u884c<code>docker run -it --rm --name &lt;container_name&gt; &lt;image_name&gt;<\/code>\u547d\u4ee4\u8fd0\u884cDocker\u5bb9\u5668\u3002\u4f8b\u5982\uff0c<code>docker run -it --rm --name my_python_app_container my_python_app<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u914d\u7f6eIDEA\u4f7f\u7528Docker<\/strong>\uff1a\u5728IDEA\u4e2d\uff0c\u6253\u5f00\u201cFile\u201d -&gt; \u201cSettings\u201d (Windows\u548cLinux) \u6216\u201cIntelliJ IDEA\u201d -&gt; \u201cPreferences\u201d (MacOS)\uff0c\u9009\u62e9\u201cBuild, Execution, Deployment\u201d -&gt; \u201cDocker\u201d\u3002\u5728\u201cDocker\u201d\u9009\u9879\u5361\u4e2d\uff0c\u70b9\u51fb\u201c+\u201d\u53f7\u6dfb\u52a0\u65b0\u7684Docker\u914d\u7f6e\uff0c\u9009\u62e9Docker\u4e3b\u673a\u7c7b\u578b\uff0c\u586b\u5199Docker\u4e3b\u673a\u5730\u5740\u548c\u8fde\u63a5\u65b9\u5f0f\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u521b\u5efaDocker\u8fd0\u884c\u914d\u7f6e<\/strong>\uff1a\u5728IDEA\u4e2d\uff0c\u9009\u62e9\u201cRun\u201d -&gt; \u201cEdit Configurations\u201d\uff0c\u70b9\u51fb\u5de6\u4e0a\u89d2\u7684\u201c+\u201d\u53f7\uff0c\u9009\u62e9\u201cDocker\u201d\u3002\u586b\u5199Docker\u955c\u50cf\u540d\u79f0\u548c\u5bb9\u5668\u540d\u79f0\uff0c\u9009\u62e9\u8981\u8fd0\u884c\u7684Python\u811a\u672c\u8def\u5f84\u3002\u70b9\u51fb\u201cRun\u201d\u6309\u94ae\u8fd0\u884cDocker\u5bb9\u5668\u4e2d\u7684Python\u811a\u672c\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u5341\u4e94\u3001\u4f7f\u7528Jupyter Notebook<\/h3>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5b89\u88c5Jupyter Notebook<\/strong>\uff1a\u5728\u865a\u62df\u73af\u5883\u6fc0\u6d3b\u72b6\u6001\u4e0b\uff0c\u53ef\u4ee5\u4f7f\u7528<code>pip<\/code>\u547d\u4ee4\u5b89\u88c5Jupyter Notebook\u3002\u4f8b\u5982\uff0c<code>pip install jupyter<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u542f\u52a8Jupyter Notebook<\/strong>\uff1a\u5728\u547d\u4ee4\u884c\u7a97\u53e3\u4e2d\uff0c\u8fdb\u5165\u9879\u76ee\u76ee\u5f55\uff0c\u8fd0\u884c<code>jupyter notebook<\/code>\u547d\u4ee4\u542f\u52a8Jupyter Notebook\u670d\u52a1\u5668\u3002\u6d4f\u89c8\u5668\u5c06\u81ea\u52a8\u6253\u5f00Jupyter Notebook\u754c\u9762\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u521b\u5efaNotebook\u6587\u4ef6<\/strong>\uff1a\u5728Jupyter Notebook\u754c\u9762\u4e2d\uff0c\u70b9\u51fb\u201cNew\u201d\u6309\u94ae\uff0c\u9009\u62e9\u201cPython 3\u201d\u521b\u5efa\u65b0\u7684Notebook\u6587\u4ef6\u3002\u5728Notebook\u6587\u4ef6\u4e2d\uff0c\u53ef\u4ee5\u7f16\u5199\u3001\u8fd0\u884c\u548c\u8c03\u8bd5Python\u4ee3\u7801\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u914d\u7f6eIDEA\u4f7f\u7528Jupyter Notebook<\/strong>\uff1a\u5728IDEA\u4e2d\uff0c\u5b89\u88c5\u201cJupyter\u201d\u63d2\u4ef6\u3002\u6253\u5f00\u201cFile\u201d -&gt; \u201cSettings\u201d (Windows\u548cLinux) \u6216\u201cIntelliJ IDEA\u201d -&gt; \u201cPreferences\u201d (MacOS)\uff0c\u9009\u62e9\u201cPlugins\u201d\u9009\u9879\u5361\uff0c\u641c\u7d22\u201cJupyter\u201d\u63d2\u4ef6\u5e76\u5b89\u88c5\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7f16\u8f91\u548c\u8fd0\u884cNotebook\u6587\u4ef6<\/strong>\uff1a\u5728IDEA\u4e2d\uff0c\u6253\u5f00\u9879\u76ee\u76ee\u5f55\u4e2d\u7684Notebook\u6587\u4ef6\uff0c\u53ef\u4ee5\u76f4\u63a5\u5728IDEA\u4e2d\u7f16\u8f91\u548c\u8fd0\u884cNotebook\u6587\u4ef6\u3002\u8fd0\u884c\u7ed3\u679c\u548c\u8f93\u51fa\u5c06\u663e\u793a\u5728IDEA\u754c\u9762\u4e2d\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4ee5\u4e0a\u5185\u5bb9\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u5982\u4f55\u5728IntelliJ IDEA\u4e2d\u914d\u7f6ePython\u8fd0\u884c\u73af\u5883\u7684\u5404\u4e2a\u6b65\u9aa4\u548c\u4f7f\u7528\u65b9\u6cd5\u3002\u901a\u8fc7\u5b89\u88c5Python\u89e3\u91ca\u5668\u3001\u5b89\u88c5\u548c\u914d\u7f6ePyCharm\u63d2\u4ef6\u3001\u521b\u5efaPython\u9879\u76ee\u3001\u914d\u7f6e\u8fd0\u884c\u73af\u5883\u3001\u8c03\u8bd5Python\u4ee3\u7801\u3001\u4f7f\u7528\u865a\u62df\u73af\u5883\u3001\u4f7f\u7528\u4ee3\u7801\u68c0\u67e5\u548c\u683c\u5f0f\u5316\u5de5\u5177\u3001\u4f7f\u7528\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u3001\u4f7f\u7528\u6d4b\u8bd5\u6846\u67b6\u3001\u4f7f\u7528\u6587\u6863\u751f\u6210\u5de5\u5177\u3001\u4f7f\u7528\u4ee3\u7801\u5206\u6790\u5de5\u5177\u3001\u4f7f\u7528\u4f9d\u8d56\u7ba1\u7406\u5de5\u5177\u3001\u4f7f\u7528\u8fdc\u7a0b\u5f00\u53d1\u73af\u5883\u3001\u4f7f\u7528Docker\u5bb9\u5668\u4ee5\u53ca\u4f7f\u7528Jupyter Notebook\u7b49\u64cd\u4f5c\uff0c\u53ef\u4ee5\u5e2e\u52a9\u60a8\u5728IDEA\u4e2d\u987a\u5229\u8fdb\u884cPython\u5f00\u53d1\u3002\u5e0c\u671b\u8fd9\u4e9b\u5185\u5bb9\u5bf9\u60a8\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728IDEA\u4e2d\u5b89\u88c5Python\u63d2\u4ef6\uff1f<\/strong><br \/>\u5728IDEA\u4e2d\u914d\u7f6ePython\u8fd0\u884c\u73af\u5883\u7684\u7b2c\u4e00\u6b65\u662f\u5b89\u88c5Python\u63d2\u4ef6\u3002\u6253\u5f00IDEA\uff0c\u8fdb\u5165\u201cFile\u201d\u83dc\u5355\uff0c\u9009\u62e9\u201cSettings\u201d\u6216\u201cPreferences\u201d\u3002\u5728\u5f39\u51fa\u7684\u7a97\u53e3\u4e2d\uff0c\u627e\u5230\u201cPlugins\u201d\u9009\u9879\uff0c\u641c\u7d22\u201cPython\u201d\uff0c\u5e76\u70b9\u51fb\u201cInstall\u201d\u6309\u94ae\u8fdb\u884c\u5b89\u88c5\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u91cd\u542fIDEA\u4ee5\u786e\u4fdd\u63d2\u4ef6\u751f\u6548\u3002<\/p>\n<p><strong>\u5982\u4f55\u521b\u5efaPython\u9879\u76ee\u5e76\u914d\u7f6e\u89e3\u91ca\u5668\uff1f<\/strong><br \/>\u5728\u5b89\u88c5\u5b8cPython\u63d2\u4ef6\u540e\uff0c\u60a8\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Python\u9879\u76ee\u3002\u9009\u62e9\u201cFile\u201d &gt; \u201cNew Project\u201d\uff0c\u5728\u9879\u76ee\u7c7b\u578b\u4e2d\u9009\u62e9\u201cPython\u201d\u3002\u5728\u521b\u5efa\u9879\u76ee\u65f6\uff0c\u60a8\u9700\u8981\u914d\u7f6ePython\u89e3\u91ca\u5668\uff0c\u60a8\u53ef\u4ee5\u9009\u62e9\u7cfb\u7edf\u4e2d\u5df2\u5b89\u88c5\u7684Python\u7248\u672c\u6216\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u865a\u62df\u73af\u5883\u3002\u786e\u4fdd\u9009\u62e9\u5408\u9002\u7684\u89e3\u91ca\u5668\uff0c\u4ee5\u4fbf\u80fd\u591f\u6b63\u786e\u8fd0\u884cPython\u4ee3\u7801\u3002<\/p>\n<p><strong>IDEA\u4e2d\u5982\u4f55\u8fd0\u884cPython\u811a\u672c\uff1f<\/strong><br \/>\u914d\u7f6e\u597dPython\u9879\u76ee\u548c\u89e3\u91ca\u5668\u540e\uff0c\u60a8\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884cPython\u811a\u672c\u3002\u53f3\u952e\u70b9\u51fb\u60a8\u8981\u8fd0\u884c\u7684Python\u6587\u4ef6\uff0c\u9009\u62e9\u201cRun &#39;\u6587\u4ef6\u540d&#39;\u201d\u3002IDEA\u4f1a\u81ea\u52a8\u8c03\u7528\u914d\u7f6e\u597d\u7684\u89e3\u91ca\u5668\u6267\u884c\u8be5\u811a\u672c\uff0c\u60a8\u53ef\u4ee5\u5728\u4e0b\u65b9\u7684\u201cRun\u201d\u7a97\u53e3\u4e2d\u67e5\u770b\u8f93\u51fa\u7ed3\u679c\u53ca\u4efb\u4f55\u53ef\u80fd\u7684\u9519\u8bef\u4fe1\u606f\u3002\u8fd9\u79cd\u65b9\u5f0f\u4f7f\u5f97\u8c03\u8bd5\u548c\u8fd0\u884cPython\u4ee3\u7801\u53d8\u5f97\u66f4\u52a0\u4fbf\u6377\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728IDEA\u914d\u7f6ePython\u8fd0\u884c\u65f6\u9700\u8981\u8fdb\u884c\u4ee5\u4e0b\u51e0\u4e2a\u6b65\u9aa4\uff1a\u5b89\u88c5Python\u89e3\u91ca\u5668\u3001\u5b89\u88c5\u548c\u914d\u7f6ePyCharm\u63d2\u4ef6\u3001\u521b [&hellip;]","protected":false},"author":3,"featured_media":1160358,"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\/1160351"}],"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=1160351"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1160351\/revisions"}],"predecessor-version":[{"id":1160360,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1160351\/revisions\/1160360"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1160358"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1160351"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1160351"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1160351"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}