{"id":1001054,"date":"2024-12-27T09:56:37","date_gmt":"2024-12-27T01:56:37","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1001054.html"},"modified":"2024-12-27T09:56:43","modified_gmt":"2024-12-27T01:56:43","slug":"%e5%a6%82%e4%bd%95%e6%89%93%e5%bc%80python%e5%b7%a5%e7%a8%8b%e6%96%87%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1001054.html","title":{"rendered":"\u5982\u4f55\u6253\u5f00python\u5de5\u7a0b\u6587\u4ef6"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25075408\/c0f453ab-2ca9-4acf-b6c2-25c234fd684b.webp\" alt=\"\u5982\u4f55\u6253\u5f00python\u5de5\u7a0b\u6587\u4ef6\" \/><\/p>\n<p><p> <strong>\u8981\u6253\u5f00Python\u5de5\u7a0b\u6587\u4ef6\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u3001\u6587\u672c\u7f16\u8f91\u5668\u3001\u547d\u4ee4\u884c\u5de5\u5177\u3002<\/strong>\u8fd9\u4e9b\u65b9\u6cd5\u5404\u6709\u4f18\u7f3a\u70b9\uff0c\u9009\u62e9\u54ea\u79cd\u65b9\u5f0f\u53ef\u4ee5\u6839\u636e\u4e2a\u4eba\u504f\u597d\u548c\u5177\u4f53\u9700\u6c42\u3002\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u4f7f\u7528IDE\u548c\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00Python\u5de5\u7a0b\u6587\u4ef6\u7684\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u4f7f\u7528IDE\u6253\u5f00Python\u5de5\u7a0b\u6587\u4ef6<\/p>\n<\/p>\n<p><p>\u4f7f\u7528\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u662f\u6253\u5f00\u548c\u7ba1\u7406Python\u5de5\u7a0b\u6587\u4ef6\u6700\u5e38\u89c1\u548c\u65b9\u4fbf\u7684\u65b9\u6cd5\u3002IDE\u901a\u5e38\u63d0\u4f9b\u4e86\u4ee3\u7801\u8865\u5168\u3001\u8c03\u8bd5\u3001\u7248\u672c\u63a7\u5236\u7b49\u529f\u80fd\uff0c\u80fd\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u9009\u62e9\u5408\u9002\u7684IDE<\/strong><\/p>\n<\/p>\n<p><p>\u5e38\u7528\u7684Python IDE\u6709PyCharm\u3001Visual Studio Code\u3001Eclipse\uff08\u914d\u5408PyDev\u63d2\u4ef6\uff09\u7b49\u3002PyCharm\u662f\u4e13\u4e3aPython\u5f00\u53d1\u8bbe\u8ba1\u7684IDE\uff0c\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u529f\u80fd\u652f\u6301\u3002Visual Studio Code\u662f\u4e00\u6b3e\u8f7b\u91cf\u7ea7\u7684\u4ee3\u7801\u7f16\u8f91\u5668\uff0c\u652f\u6301\u591a\u79cd\u8bed\u8a00\u7684\u6269\u5c55\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5\u548c\u914d\u7f6eIDE<\/strong><\/p>\n<\/p>\n<p><p>\u4e0b\u8f7d\u5e76\u5b89\u88c5\u4f60\u9009\u62e9\u7684IDE\u3002\u5b89\u88c5\u8fc7\u7a0b\u901a\u5e38\u6bd4\u8f83\u7b80\u5355\uff0c\u53ea\u9700\u6309\u7167\u5b89\u88c5\u5411\u5bfc\u7684\u6b65\u9aa4\u8fdb\u884c\u5373\u53ef\u3002\u5728\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u80fd\u9700\u8981\u8fdb\u884c\u4e00\u4e9b\u57fa\u672c\u914d\u7f6e\uff0c\u5982\u8bbe\u7f6ePython\u89e3\u91ca\u5668\u8def\u5f84\u3001\u5b89\u88c5\u5fc5\u8981\u7684\u63d2\u4ef6\u6216\u6269\u5c55\u7b49\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5bfc\u5165Python\u5de5\u7a0b\u6587\u4ef6<\/strong><\/p>\n<\/p>\n<p><p>\u5728IDE\u4e2d\u6253\u5f00\u9879\u76ee\u7684\u65b9\u5f0f\u901a\u5e38\u662f\u9009\u62e9\u201cFile\u201d\u83dc\u5355\u4e0b\u7684\u201cOpen Project\u201d\u6216\u201cImport Project\u201d\u3002\u5728\u5f39\u51fa\u7684\u5bf9\u8bdd\u6846\u4e2d\uff0c\u9009\u62e9\u4f60\u8981\u6253\u5f00\u7684Python\u9879\u76ee\u7684\u6839\u76ee\u5f55\u3002IDE\u4f1a\u81ea\u52a8\u8bc6\u522b\u9879\u76ee\u4e2d\u7684Python\u6587\u4ef6\u548c\u4f9d\u8d56\u5e93\uff0c\u5e76\u5728\u9879\u76ee<a href=\"https:\/\/docs.pingcode.com\/blog\/project-management\/58557.html\" target=\"_blank\">\u8d44\u6e90\u7ba1\u7406<\/a>\u5668\u4e2d\u663e\u793a\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8fd0\u884c\u548c\u8c03\u8bd5\u4ee3\u7801<\/strong><\/p>\n<\/p>\n<p><p>\u5728IDE\u4e2d\uff0c\u4f60\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884cPython\u811a\u672c\uff0c\u901a\u5e38\u53ea\u9700\u53f3\u952e\u70b9\u51fb\u8981\u8fd0\u884c\u7684\u6587\u4ef6\uff0c\u9009\u62e9\u201cRun\u201d\u9009\u9879\u5373\u53ef\u3002\u5927\u591a\u6570IDE\u4e5f\u63d0\u4f9b\u4e86\u8c03\u8bd5\u5de5\u5177\uff0c\u5141\u8bb8\u4f60\u8bbe\u7f6e\u65ad\u70b9\u3001\u5355\u6b65\u6267\u884c\u4ee3\u7801\u3001\u68c0\u67e5\u53d8\u91cf\u503c\u7b49\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e8c\u3001\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00Python\u5de5\u7a0b\u6587\u4ef6<\/p>\n<\/p>\n<p><p>\u6587\u672c\u7f16\u8f91\u5668\u662f\u4e00\u79cd\u8f7b\u91cf\u7ea7\u7684\u4ee3\u7801\u7f16\u5199\u5de5\u5177\uff0c\u9002\u5408\u5feb\u901f\u67e5\u770b\u548c\u7f16\u8f91Python\u4ee3\u7801\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u9009\u62e9\u5408\u9002\u7684\u6587\u672c\u7f16\u8f91\u5668<\/strong><\/p>\n<\/p>\n<p><p>\u5e38\u7528\u7684\u6587\u672c\u7f16\u8f91\u5668\u6709Sublime Text\u3001Atom\u3001Notepad++\u3001Visual Studio Code\u7b49\u3002Visual Studio Code\u867d\u7136\u4e5f\u662fIDE\uff0c\u4f46\u4e5f\u53ef\u4ee5\u4f5c\u4e3a\u6587\u672c\u7f16\u8f91\u5668\u6765\u4f7f\u7528\uff0c\u5177\u6709\u8f7b\u91cf\u548c\u5f3a\u5927\u7684\u6269\u5c55\u529f\u80fd\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5\u548c\u914d\u7f6e\u6587\u672c\u7f16\u8f91\u5668<\/strong><\/p>\n<\/p>\n<p><p>\u4e0b\u8f7d\u5e76\u5b89\u88c5\u4f60\u9009\u62e9\u7684\u6587\u672c\u7f16\u8f91\u5668\u3002\u53ef\u4ee5\u6839\u636e\u9700\u8981\u5b89\u88c5\u4e00\u4e9b\u63d2\u4ef6\u6765\u589e\u5f3a\u7f16\u8f91\u5668\u7684\u529f\u80fd\uff0c\u6bd4\u5982\u4ee3\u7801\u9ad8\u4eae\u3001\u4ee3\u7801\u8865\u5168\u3001\u7248\u672c\u63a7\u5236\u652f\u6301\u7b49\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6253\u5f00Python\u6587\u4ef6<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00Python\u5de5\u7a0b\u6587\u4ef6\u65f6\uff0c\u901a\u5e38\u53ea\u9700\u9009\u62e9\u201cFile\u201d\u83dc\u5355\u4e0b\u7684\u201cOpen File\u201d\u9009\u9879\uff0c\u627e\u5230\u4f60\u8981\u67e5\u770b\u7684Python\u6587\u4ef6\u5e76\u6253\u5f00\u5373\u53ef\u3002\u6587\u672c\u7f16\u8f91\u5668\u4e0d\u4f1a\u50cfIDE\u90a3\u6837\u81ea\u52a8\u7ba1\u7406\u9879\u76ee\u7ed3\u6784\uff0c\u4f46\u80fd\u5feb\u901f\u6253\u5f00\u548c\u7f16\u8f91\u5355\u4e2a\u6587\u4ef6\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6267\u884cPython\u4ee3\u7801<\/strong><\/p>\n<\/p>\n<p><p>\u867d\u7136\u6587\u672c\u7f16\u8f91\u5668\u4e0d\u63d0\u4f9b\u76f4\u63a5\u7684\u8fd0\u884c\u548c\u8c03\u8bd5\u529f\u80fd\uff0c\u4f46\u4f60\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u5de5\u5177\u6765\u6267\u884cPython\u4ee3\u7801\u3002\u5728\u547d\u4ee4\u884c\u4e2d\u5bfc\u822a\u5230Python\u811a\u672c\u6240\u5728\u7684\u76ee\u5f55\uff0c\u7136\u540e\u4f7f\u7528\u547d\u4ee4<code>python script_name.py<\/code>\u6765\u8fd0\u884c\u4ee3\u7801\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177\u6253\u5f00Python\u5de5\u7a0b\u6587\u4ef6<\/p>\n<\/p>\n<p><p>\u547d\u4ee4\u884c\u5de5\u5177\u662f\u5f00\u53d1\u4eba\u5458\u5e38\u7528\u7684\u5de5\u5177\u4e4b\u4e00\uff0c\u867d\u7136\u6ca1\u6709\u56fe\u5f62\u754c\u9762\u7684\u4fbf\u5229\uff0c\u4f46\u975e\u5e38\u9002\u5408\u81ea\u52a8\u5316\u548c\u6279\u91cf\u5904\u7406\u4efb\u52a1\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6253\u5f00\u547d\u4ee4\u884c\u5de5\u5177<\/strong><\/p>\n<\/p>\n<p><p>\u5728Windows\u4e0a\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u63d0\u793a\u7b26\uff08cmd\uff09\u6216PowerShell\uff0c\u5728macOS\u548cLinux\u4e0a\u53ef\u4ee5\u4f7f\u7528\u7ec8\u7aef\uff08Terminal\uff09\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5bfc\u822a\u5230\u9879\u76ee\u76ee\u5f55<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528<code>cd<\/code>\u547d\u4ee4\u5207\u6362\u5230Python\u9879\u76ee\u6240\u5728\u7684\u76ee\u5f55\u3002\u4f8b\u5982\uff0c<code>cd \/path\/to\/your\/project<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8fd0\u884cPython\u4ee3\u7801<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528<code>python<\/code>\u547d\u4ee4\u6267\u884cPython\u811a\u672c\u3002\u4f8b\u5982\uff0c<code>python m<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>n.py<\/code>\u3002\u786e\u4fdd\u4f60\u5df2\u7ecf\u5b89\u88c5\u4e86Python\uff0c\u5e76\u4e14\u8bbe\u7f6e\u4e86\u6b63\u786e\u7684\u73af\u5883\u53d8\u91cf\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7ba1\u7406\u4f9d\u8d56<\/strong><\/p>\n<\/p>\n<p><p>\u5982\u679c\u9879\u76ee\u4e2d\u4f7f\u7528\u4e86\u865a\u62df\u73af\u5883\u6216\u9700\u8981\u5b89\u88c5\u4f9d\u8d56\u5e93\uff0c\u53ef\u4ee5\u4f7f\u7528<code>pip<\/code>\u547d\u4ee4\u7ba1\u7406\u3002\u4f8b\u5982\uff0c<code>pip install -r requirements.txt<\/code>\u5b89\u88c5\u9879\u76ee\u6240\u9700\u7684\u4f9d\u8d56\u5e93\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u56db\u3001\u603b\u7ed3<\/p>\n<\/p>\n<p><p>\u6253\u5f00Python\u5de5\u7a0b\u6587\u4ef6\u7684\u65b9\u6cd5\u6709\u5f88\u591a\uff0c\u9009\u62e9\u54ea\u79cd\u65b9\u5f0f\u4e3b\u8981\u53d6\u51b3\u4e8e\u4f60\u7684\u5f00\u53d1\u4e60\u60ef\u548c\u9879\u76ee\u9700\u6c42\u3002IDE\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u529f\u80fd\u652f\u6301\uff0c\u9002\u5408\u590d\u6742\u9879\u76ee\u548c\u957f\u671f\u5f00\u53d1\u3002\u6587\u672c\u7f16\u8f91\u5668\u8f7b\u91cf\u5feb\u6377\uff0c\u9002\u5408\u5feb\u901f\u7f16\u8f91\u548c\u5c0f\u578b\u9879\u76ee\u3002\u547d\u4ee4\u884c\u5de5\u5177\u867d\u7136\u7b80\u6d01\uff0c\u4f46\u975e\u5e38\u5f3a\u5927\uff0c\u9002\u5408\u81ea\u52a8\u5316\u548c\u6279\u91cf\u4efb\u52a1\u3002\u65e0\u8bba\u4f7f\u7528\u54ea\u79cd\u65b9\u6cd5\uff0c\u4e86\u89e3\u6bcf\u79cd\u5de5\u5177\u7684\u7279\u70b9\u548c\u9002\u7528\u573a\u666f\uff0c\u53ef\u4ee5\u5e2e\u52a9\u4f60\u66f4\u9ad8\u6548\u5730\u8fdb\u884cPython\u5f00\u53d1\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u786e\u8ba4\u6211\u7684Python\u5de5\u7a0b\u6587\u4ef6\u7684\u6b63\u786e\u683c\u5f0f\uff1f<\/strong><br \/>\u5728\u6253\u5f00Python\u5de5\u7a0b\u6587\u4ef6\u4e4b\u524d\uff0c\u786e\u4fdd\u6587\u4ef6\u4ee5<code>.py<\/code>\u6216<code>.ipynb<\/code>\u4e3a\u540e\u7f00\u3002<code>.py<\/code>\u662f\u6807\u51c6\u7684Python\u811a\u672c\u6587\u4ef6\uff0c\u800c<code>.ipynb<\/code>\u662fJupyter Notebook\u6587\u4ef6\u3002\u5982\u679c\u6587\u4ef6\u683c\u5f0f\u4e0d\u5bf9\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u65e0\u6cd5\u6b63\u786e\u6253\u5f00\u6216\u6267\u884c\u4ee3\u7801\u3002<\/p>\n<p><strong>\u6211\u9700\u8981\u4f7f\u7528\u4ec0\u4e48\u5de5\u5177\u6765\u6253\u5f00Python\u5de5\u7a0b\u6587\u4ef6\uff1f<\/strong><br \/>\u6253\u5f00Python\u5de5\u7a0b\u6587\u4ef6\u53ef\u4ee5\u4f7f\u7528\u591a\u79cd\u5de5\u5177\uff0c\u4f8b\u5982\uff1a  <\/p>\n<ul>\n<li><strong>\u6587\u672c\u7f16\u8f91\u5668<\/strong>\uff1a\u5982VS Code\u3001Sublime Text\u548cAtom\u7b49\uff0c\u63d0\u4f9b\u826f\u597d\u7684\u4ee3\u7801\u9ad8\u4eae\u548c\u7f16\u8f91\u529f\u80fd\u3002  <\/li>\n<li><strong>\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09<\/strong>\uff1a\u5982PyCharm\u548cSpyder\uff0c\u4e13\u4e3aPython\u5f00\u53d1\u8bbe\u8ba1\uff0c\u63d0\u4f9b\u8c03\u8bd5\u3001\u6d4b\u8bd5\u7b49\u4e30\u5bcc\u529f\u80fd\u3002  <\/li>\n<li><strong>Jupyter Notebook<\/strong>\uff1a\u9002\u5408\u6570\u636e\u5206\u6790\u548c<a href=\"https:\/\/docs.pingcode.com\/ask\/59192.html\" target=\"_blank\">\u673a\u5668\u5b66\u4e60<\/a>\u9879\u76ee\uff0c\u53ef\u4ee5\u4ea4\u4e92\u5f0f\u5730\u6267\u884c\u4ee3\u7801\u5e76\u5c55\u793a\u7ed3\u679c\u3002<\/li>\n<\/ul>\n<p><strong>\u6253\u5f00Python\u5de5\u7a0b\u6587\u4ef6\u65f6\u9047\u5230\u9519\u8bef\uff0c\u5982\u4f55\u89e3\u51b3\uff1f<\/strong><br \/>\u5982\u679c\u5728\u6253\u5f00\u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u9996\u5148\u68c0\u67e5\u6587\u4ef6\u8def\u5f84\u662f\u5426\u6b63\u786e\uff0c\u786e\u4fdd\u6587\u4ef6\u5b58\u5728\u4e8e\u6307\u5b9a\u4f4d\u7f6e\u3002\u5176\u6b21\uff0c\u786e\u8ba4\u662f\u5426\u5df2\u5b89\u88c5\u5fc5\u8981\u7684\u5e93\u6216\u4f9d\u8d56\u9879\u3002\u67e5\u770b\u9519\u8bef\u4fe1\u606f\uff0c\u4ee5\u786e\u5b9a\u662f\u5426\u662f\u4ee3\u7801\u4e2d\u7684\u95ee\u9898\uff0c\u5fc5\u8981\u65f6\u53ef\u4ee5\u5728\u76f8\u5173\u793e\u533a\u6216\u8bba\u575b\u5bfb\u6c42\u5e2e\u52a9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u6253\u5f00Python\u5de5\u7a0b\u6587\u4ef6\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u3001\u6587\u672c\u7f16\u8f91\u5668\u3001\u547d\u4ee4\u884c\u5de5\u5177\u3002\u8fd9\u4e9b\u65b9\u6cd5\u5404\u6709\u4f18\u7f3a\u70b9\uff0c\u9009\u62e9 [&hellip;]","protected":false},"author":3,"featured_media":1001071,"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\/1001054"}],"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=1001054"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1001054\/revisions"}],"predecessor-version":[{"id":1001074,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1001054\/revisions\/1001074"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1001071"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1001054"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1001054"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1001054"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}