{"id":946341,"date":"2024-12-26T23:40:26","date_gmt":"2024-12-26T15:40:26","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/946341.html"},"modified":"2024-12-26T23:40:28","modified_gmt":"2024-12-26T15:40:28","slug":"emacs-%e5%a6%82%e4%bd%95%e7%bc%96%e8%af%91python","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/946341.html","title":{"rendered":"emacs \u5982\u4f55\u7f16\u8bd1python"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25082544\/1d04b5ec-f81d-411f-82cf-b6721b032ec2.webp\" alt=\"emacs \u5982\u4f55\u7f16\u8bd1python\" \/><\/p>\n<p><p> <strong>\u5728Emacs\u4e2d\u7f16\u8bd1Python\u4ee3\u7801\uff0c\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528\u5185\u7f6e\u7684\u7f16\u8bd1\u5668\u63a5\u53e3\u3001\u501f\u52a9\u5916\u90e8\u5de5\u5177\u5305\u3001\u6216\u914d\u7f6e\u9879\u76ee\u7279\u5b9a\u7684\u5de5\u4f5c\u6d41\u6765\u5b9e\u73b0\u3002\u5e38\u89c1\u7684\u65b9\u6cd5\u5305\u62ec\u4f7f\u7528<code>M-x compile<\/code>\u547d\u4ee4\u3001\u96c6\u6210Python\u4ea4\u4e92\u6a21\u5f0f\u3001\u4ee5\u53ca\u501f\u52a9\u7b2c\u4e09\u65b9\u63d2\u4ef6\u5982elpy\u548cjedi\u6765\u589e\u5f3a\u5f00\u53d1\u4f53\u9a8c\u3002<\/strong>\u5176\u4e2d\uff0c<code>M-x compile<\/code>\u547d\u4ee4\u662f\u6700\u57fa\u7840\u7684\u65b9\u6cd5\uff0c\u7528\u6237\u53ef\u4ee5\u5728Emacs\u4e2d\u4f7f\u7528\u6b64\u547d\u4ee4\u6765\u8fd0\u884cPython\u811a\u672c\u5e76\u67e5\u770b\u8f93\u51fa\u3002\u901a\u8fc7\u5728Emacs\u7684\u7f16\u8bd1\u5668\u63a5\u53e3\u4e2d\u8f93\u5165Python\u547d\u4ee4\u884c\uff0c\u7528\u6237\u80fd\u591f\u5feb\u901f\u7f16\u8bd1\u548c\u6d4b\u8bd5\u4ee3\u7801\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u4f7f\u7528 <code>M-x compile<\/code> \u547d\u4ee4<\/p>\n<\/p>\n<p><p>Emacs\u63d0\u4f9b\u4e86\u4e00\u4e2a\u5f3a\u5927\u7684\u7f16\u8bd1\u5668\u63a5\u53e3\uff0c\u901a\u8fc7<code>M-x compile<\/code>\u547d\u4ee4\uff0c\u7528\u6237\u53ef\u4ee5\u5728\u4efb\u610f\u7f13\u51b2\u533a\u5185\u8fd0\u884c\u5916\u90e8\u7f16\u8bd1\u5668\u6216\u89e3\u91ca\u5668\u3002\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u542f\u52a8\u7f16\u8bd1\u547d\u4ee4<\/strong><br \/>\u5728Emacs\u4e2d\u6253\u5f00\u4f60\u6b63\u5728\u7f16\u8f91\u7684Python\u6587\u4ef6\uff0c\u7136\u540e\u6309\u4e0b <code>M-x<\/code>\uff0c\u8f93\u5165 <code>compile<\/code>\uff0c\u5e76\u6309\u56de\u8f66\u3002\u8fd9\u5c06\u6253\u5f00\u4e00\u4e2a\u547d\u4ee4\u884c\u63d0\u793a\uff0c\u5141\u8bb8\u4f60\u8f93\u5165\u8981\u8fd0\u884c\u7684\u7f16\u8bd1\u547d\u4ee4\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8f93\u5165Python\u547d\u4ee4<\/strong><br \/>\u5728\u547d\u4ee4\u884c\u63d0\u793a\u4e2d\uff0c\u8f93\u5165 <code>python &lt;filename&gt;.py<\/code>\uff0c\u5176\u4e2d <code>&lt;filename&gt;<\/code> \u662f\u4f60\u5f53\u524d\u7f16\u8f91\u7684Python\u6587\u4ef6\u7684\u540d\u79f0\u3002\u6309\u56de\u8f66\uff0cEmacs\u5c06\u8c03\u7528Python\u89e3\u91ca\u5668\u6765\u6267\u884c\u8be5\u6587\u4ef6\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u67e5\u770b\u8f93\u51fa<\/strong><br \/>Emacs\u4f1a\u5728\u4e00\u4e2a\u65b0\u7684\u7f13\u51b2\u533a\u4e2d\u663e\u793aPython\u89e3\u91ca\u5668\u7684\u8f93\u51fa\uff0c\u5305\u62ec\u4efb\u4f55\u6807\u51c6\u8f93\u51fa\u548c\u9519\u8bef\u4fe1\u606f\u3002\u8fd9\u4f7f\u5f97\u7528\u6237\u53ef\u4ee5\u5728\u540c\u4e00\u4e2a\u7f16\u8f91\u73af\u5883\u4e2d\u67e5\u770b\u8fd0\u884c\u7ed3\u679c\u5e76\u8fdb\u884c\u8c03\u8bd5\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p><strong>\u4f18\u70b9<\/strong>\uff1a\u8fd9\u79cd\u65b9\u6cd5\u7b80\u5355\u76f4\u63a5\uff0c\u4e0d\u9700\u8981\u989d\u5916\u7684\u914d\u7f6e\uff0c\u9002\u7528\u4e8e\u5c0f\u578b\u9879\u76ee\u6216\u5feb\u901f\u6d4b\u8bd5\u4ee3\u7801\u7247\u6bb5\u3002<\/p>\n<\/p>\n<p><p>\u4e8c\u3001\u4f7f\u7528Python\u4ea4\u4e92\u6a21\u5f0f<\/p>\n<\/p>\n<p><p>Emacs\u7684Python\u4ea4\u4e92\u6a21\u5f0f\uff08Python mode\uff09\u5141\u8bb8\u7528\u6237\u5728\u4e00\u4e2a\u4ea4\u4e92\u5f0f\u89e3\u91ca\u5668\u4e2d\u8fd0\u884cPython\u4ee3\u7801\u3002\u8fd9\u79cd\u6a21\u5f0f\u5bf9\u8c03\u8bd5\u548c\u6d4b\u8bd5\u4ee3\u7801\u7247\u6bb5\u7279\u522b\u6709\u7528\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u542f\u52a8Python\u4ea4\u4e92\u6a21\u5f0f<\/strong><br \/>\u5728Emacs\u4e2d\u6253\u5f00Python\u6587\u4ef6\uff0c\u7136\u540e\u6309\u4e0b <code>M-x<\/code>\uff0c\u8f93\u5165 <code>run-python<\/code>\uff0c\u5e76\u6309\u56de\u8f66\u3002\u8fd9\u5c06\u542f\u52a8\u4e00\u4e2aPython\u89e3\u91ca\u5668\u5e76\u5728Emacs\u4e2d\u6253\u5f00\u4e00\u4e2a\u4ea4\u4e92\u5f0f\u7f13\u51b2\u533a\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u53d1\u9001\u4ee3\u7801\u5230\u89e3\u91ca\u5668<\/strong><br \/>\u5728Python\u6587\u4ef6\u4e2d\uff0c\u9009\u62e9\u4f60\u8981\u8fd0\u884c\u7684\u4ee3\u7801\u7247\u6bb5\uff0c\u7136\u540e\u6309\u4e0b <code>C-c C-c<\/code>\uff08\u6216 <code>C-c C-r<\/code> \u8fd0\u884c\u9009\u5b9a\u533a\u57df\uff09\u3002\u8fd9\u4f1a\u5c06\u9009\u5b9a\u7684\u4ee3\u7801\u53d1\u9001\u5230\u4ea4\u4e92\u5f0f\u89e3\u91ca\u5668\u4e2d\u6267\u884c\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u67e5\u770b\u7ed3\u679c<\/strong><br \/>\u6267\u884c\u7ed3\u679c\u4f1a\u7acb\u5373\u663e\u793a\u5728\u4ea4\u4e92\u5f0f\u7f13\u51b2\u533a\u4e2d\uff0c\u7528\u6237\u53ef\u4ee5\u5728\u6b64\u57fa\u7840\u4e0a\u8fdb\u884c\u8c03\u8bd5\u548c\u8fdb\u4e00\u6b65\u6d4b\u8bd5\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p><strong>\u4f18\u70b9<\/strong>\uff1a\u4ea4\u4e92\u6a21\u5f0f\u975e\u5e38\u9002\u5408\u9010\u884c\u6d4b\u8bd5\u4ee3\u7801\u548c\u8c03\u8bd5\u590d\u6742\u903b\u8f91\uff0c\u7528\u6237\u53ef\u4ee5\u5373\u65f6\u67e5\u770b\u53d8\u91cf\u72b6\u6001\u548c\u51fd\u6570\u8f93\u51fa\u3002<\/p>\n<\/p>\n<p><p>\u4e09\u3001\u4f7f\u7528elpy\u63d2\u4ef6<\/p>\n<\/p>\n<p><p>elpy\u662f\u4e00\u4e2a\u4e13\u4e3aEmacs\u8bbe\u8ba1\u7684Python\u5f00\u53d1\u73af\u5883\u63d2\u4ef6\uff0c\u63d0\u4f9b\u4e86\u4ee3\u7801\u8865\u5168\u3001\u8df3\u8f6c\u3001\u9519\u8bef\u68c0\u67e5\u7b49\u529f\u80fd\uff0c\u6781\u5927\u5730\u589e\u5f3a\u4e86Emacs\u7684Python\u5f00\u53d1\u4f53\u9a8c\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5b89\u88c5elpy<\/strong><br \/>\u9996\u5148\uff0c\u786e\u4fddEmacs\u5b89\u88c5\u4e86package.el\uff0c\u7136\u540e\u5728Emacs\u4e2d\u4f7f\u7528 <code>M-x package-install<\/code> \u547d\u4ee4\u5b89\u88c5elpy\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u914d\u7f6e\u5230\u4f60\u7684Emacs\u914d\u7f6e\u6587\u4ef6\u4e2d\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-emacs-lisp\">(package-initialize)<\/p>\n<p>(elpy-enable)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7f16\u8bd1\u548c\u8fd0\u884cPython\u4ee3\u7801<\/strong><br \/>\u4f7f\u7528elpy\uff0c\u7528\u6237\u53ef\u4ee5\u6309\u4e0b <code>C-c C-c<\/code> \u5728\u5f53\u524d\u7f13\u51b2\u533a\u4e2d\u7f16\u8bd1\u5e76\u8fd0\u884cPython\u6587\u4ef6\u3002elpy\u8fd8\u4f1a\u81ea\u52a8\u6355\u6349\u8fd0\u884c\u65f6\u9519\u8bef\u5e76\u5728\u4ee3\u7801\u4e2d\u9ad8\u4eae\u663e\u793a\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8c03\u8bd5\u548c\u4ee3\u7801\u5bfc\u822a<\/strong><br \/>elpy\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u8c03\u8bd5\u5de5\u5177\u548c\u4ee3\u7801\u5bfc\u822a\u529f\u80fd\uff0c\u7528\u6237\u53ef\u4ee5\u4f7f\u7528 <code>M-.<\/code> \u8df3\u8f6c\u5230\u51fd\u6570\u5b9a\u4e49\uff0c\u6216\u4f7f\u7528 <code>M-,<\/code> \u8fd4\u56de\u3002elpy\u8fd8\u96c6\u6210\u4e86flycheck\uff0c\u7528\u4e8e\u5b9e\u65f6\u8bed\u6cd5\u68c0\u67e5\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p><strong>\u4f18\u70b9<\/strong>\uff1aelpy\u63d0\u4f9b\u4e86\u4e00\u5957\u5b8c\u6574\u7684\u5f00\u53d1\u5de5\u5177\uff0c\u9002\u5408\u4e2d\u5927\u578b\u9879\u76ee\u5f00\u53d1\uff0c\u6781\u5927\u63d0\u5347\u4e86\u4ee3\u7801\u7f16\u5199\u548c\u8c03\u8bd5\u6548\u7387\u3002<\/p>\n<\/p>\n<p><p>\u56db\u3001\u96c6\u6210\u7b2c\u4e09\u65b9\u5de5\u5177<\/p>\n<\/p>\n<p><p>\u9664\u4e86elpy\uff0cEmacs\u8fd8\u53ef\u4ee5\u901a\u8fc7\u96c6\u6210\u5176\u4ed6Python\u5de5\u5177\u6765\u63d0\u5347\u7f16\u8bd1\u548c\u8fd0\u884c\u4f53\u9a8c\uff0c\u4f8b\u5982\u4f7f\u7528jedi\u8fdb\u884c\u4ee3\u7801\u8865\u5168\uff0c\u4f7f\u7528black\u8fdb\u884c\u4ee3\u7801\u683c\u5f0f\u5316\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4f7f\u7528Jedi\u8fdb\u884c\u4ee3\u7801\u8865\u5168<\/strong><br \/>Jedi\u662f\u4e00\u4e2aPython\u81ea\u52a8\u8865\u5168\u5e93\uff0c\u7528\u6237\u53ef\u4ee5\u901a\u8fc7\u5b89\u88c5jedi-core\u63d2\u4ef6\u6765\u96c6\u6210\u6b64\u529f\u80fd\u3002\u5728Emacs\u4e2d\uff0c\u4f7f\u7528 <code>M-x package-install<\/code> \u5b89\u88c5jedi-core\uff0c\u5e76\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u542f\u7528\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-emacs-lisp\">(require &#39;jedi)<\/p>\n<p>(add-hook &#39;python-mode-hook &#39;jedi:setup)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528Black\u8fdb\u884c\u4ee3\u7801\u683c\u5f0f\u5316<\/strong><br \/>Black\u662f\u4e00\u6b3e\u6d41\u884c\u7684Python\u4ee3\u7801\u683c\u5f0f\u5316\u5de5\u5177\u3002\u7528\u6237\u53ef\u4ee5\u5728Emacs\u4e2d\u914d\u7f6eBlack\u4ee5\u81ea\u52a8\u683c\u5f0f\u5316Python\u6587\u4ef6\u3002\u5728Emacs\u4e2d\uff0c\u4f7f\u7528 <code>M-x package-install<\/code> \u5b89\u88c5blacken\uff0c\u7136\u540e\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u542f\u7528\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-emacs-lisp\">(require &#39;blacken)<\/p>\n<p>(add-hook &#39;python-mode-hook &#39;blacken-mode)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7ed3\u5408\u5de5\u5177\u4f7f\u7528<\/strong><br \/>Emacs\u5141\u8bb8\u7528\u6237\u7ed3\u5408\u591a\u79cd\u5de5\u5177\u4ee5\u5f62\u6210\u4e00\u4e2a\u9ad8\u6548\u7684Python\u5f00\u53d1\u73af\u5883\u3002\u901a\u8fc7\u5c06jedi\u3001black\u3001\u4ee5\u53ca\u5176\u4ed6\u5de5\u5177\u7ed3\u5408\u4f7f\u7528\uff0c\u7528\u6237\u53ef\u4ee5\u4eab\u53d7\u81ea\u52a8\u8865\u5168\u3001\u5b9e\u65f6\u683c\u5f0f\u5316\u3001\u4ee5\u53ca\u66f4\u9ad8\u6548\u7684\u4ee3\u7801\u5bfc\u822a\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p><strong>\u4f18\u70b9<\/strong>\uff1a\u4f7f\u7528\u7b2c\u4e09\u65b9\u5de5\u5177\u53ef\u4ee5\u6839\u636e\u9879\u76ee\u9700\u6c42\u7075\u6d3b\u914d\u7f6e\u5f00\u53d1\u73af\u5883\uff0c\u63d0\u5347\u4ee3\u7801\u8d28\u91cf\u548c\u5f00\u53d1\u6548\u7387\u3002<\/p>\n<\/p>\n<p><p>\u4e94\u3001\u9879\u76ee\u7279\u5b9a\u7684\u5de5\u4f5c\u6d41<\/p>\n<\/p>\n<p><p>\u5bf9\u4e8e\u5927\u578b\u9879\u76ee\u6216\u7279\u5b9a\u9700\u6c42\uff0c\u7528\u6237\u53ef\u4ee5\u5728Emacs\u4e2d\u914d\u7f6e\u5b9a\u5236\u5316\u7684\u5de5\u4f5c\u6d41\uff0c\u4ee5\u4fbf\u66f4\u597d\u5730\u7ba1\u7406\u548c\u7f16\u8bd1\u9879\u76ee\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4f7f\u7528Makefile\u7ba1\u7406\u9879\u76ee<\/strong><br \/>\u5bf9\u4e8e\u590d\u6742\u7684\u9879\u76ee\uff0c\u4f7f\u7528Makefile\u6765\u7ba1\u7406\u7f16\u8bd1\u548c\u8fd0\u884c\u8fc7\u7a0b\u662f\u4e00\u4e2a\u597d\u65b9\u6cd5\u3002\u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e2d\u521b\u5efaMakefile\u6587\u4ef6\uff0c\u5b9a\u4e49\u7f16\u8bd1\u548c\u8fd0\u884c\u89c4\u5219\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-makefile\">run:<\/p>\n<p>    python m<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>n.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5728Emacs\u4e2d\u4f7f\u7528Makefile<\/strong><br \/>\u5728Emacs\u4e2d\uff0c\u7528\u6237\u53ef\u4ee5\u901a\u8fc7 <code>M-x compile<\/code> \u547d\u4ee4\u8fd0\u884cMakefile\u4e2d\u7684\u89c4\u5219\u3002\u5728\u547d\u4ee4\u884c\u63d0\u793a\u4e2d\uff0c\u8f93\u5165 <code>make run<\/code>\uff0cEmacs\u5c06\u81ea\u52a8\u6267\u884cMakefile\u4e2d\u7684run\u89c4\u5219\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528<a href=\"https:\/\/docs.pingcode.com\/blog\/project-management\/23316.html\" target=\"_blank\">\u9879\u76ee\u7ba1\u7406<\/a>\u5de5\u5177<\/strong><br \/>Emacs\u652f\u6301\u591a\u79cd\u9879\u76ee\u7ba1\u7406\u5de5\u5177\uff0c\u5982Projectile\uff0c\u53ef\u4ee5\u5e2e\u52a9\u7528\u6237\u5feb\u901f\u5bfc\u822a\u9879\u76ee\u6587\u4ef6\u3001\u6267\u884c\u9879\u76ee\u547d\u4ee4\u7b49\u3002\u5b89\u88c5Projectile\u5e76\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u542f\u7528\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-emacs-lisp\">(require &#39;projectile)<\/p>\n<p>(projectile-mode +1)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p><strong>\u4f18\u70b9<\/strong>\uff1a\u9879\u76ee\u7279\u5b9a\u7684\u5de5\u4f5c\u6d41\u80fd\u591f\u6709\u6548\u7ec4\u7ec7\u548c\u7ba1\u7406\u5927\u578b\u9879\u76ee\uff0c\u786e\u4fdd\u4ee3\u7801\u7f16\u8bd1\u548c\u8fd0\u884c\u7684\u9ad8\u6548\u6027\u3002<\/p>\n<\/p>\n<p><p>\u603b\u7ed3\u6765\u8bf4\uff0cEmacs\u63d0\u4f9b\u4e86\u591a\u79cd\u65b9\u6cd5\u6765\u7f16\u8bd1\u548c\u8fd0\u884cPython\u4ee3\u7801\uff0c\u7528\u6237\u53ef\u4ee5\u6839\u636e\u9879\u76ee\u89c4\u6a21\u548c\u4e2a\u4eba\u504f\u597d\u9009\u62e9\u9002\u5408\u7684\u65b9\u6cd5\u3002\u65e0\u8bba\u662f\u4f7f\u7528\u57fa\u7840\u7684\u7f16\u8bd1\u547d\u4ee4\u3001Python\u4ea4\u4e92\u6a21\u5f0f\uff0c\u8fd8\u662f\u7ed3\u5408elpy\u548c\u5176\u4ed6\u5de5\u5177\uff0cEmacs\u90fd\u80fd\u4e3aPython\u5f00\u53d1\u63d0\u4f9b\u5f3a\u6709\u529b\u7684\u652f\u6301\u3002\u901a\u8fc7\u5408\u7406\u914d\u7f6e\u548c\u4f7f\u7528\u8fd9\u4e9b\u5de5\u5177\uff0c\u5f00\u53d1\u8005\u80fd\u591f\u5728Emacs\u4e2d\u5b9e\u73b0\u9ad8\u6548\u7684Python\u5f00\u53d1\u5de5\u4f5c\u6d41\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Emacs\u4e2d\u8bbe\u7f6ePython\u7f16\u8bd1\u73af\u5883\uff1f<\/strong><br \/>\u8981\u5728Emacs\u4e2d\u8bbe\u7f6ePython\u7f16\u8bd1\u73af\u5883\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528<code>elpy<\/code>\u6216<code>python-mode<\/code>\u7b49\u63d2\u4ef6\u3002\u5b89\u88c5\u8fd9\u4e9b\u63d2\u4ef6\u540e\uff0c\u786e\u4fdd\u60a8\u5728Emacs\u914d\u7f6e\u6587\u4ef6\u4e2d\u6b63\u786e\u8bbe\u7f6e\u4e86Python\u89e3\u91ca\u5668\u7684\u8def\u5f84\u3002\u901a\u8fc7M-x elpy-enable\u6216M-x python-mode\u547d\u4ee4\u53ef\u4ee5\u6fc0\u6d3b\u5bf9\u5e94\u7684\u6a21\u5f0f\uff0c\u4ece\u800c\u83b7\u5f97\u66f4\u597d\u7684Python\u5f00\u53d1\u4f53\u9a8c\u3002<\/p>\n<p><strong>Emacs\u4e2d\u5982\u4f55\u8fd0\u884cPython\u4ee3\u7801\uff1f<\/strong><br \/>\u5728Emacs\u4e2d\u8fd0\u884cPython\u4ee3\u7801\uff0c\u53ef\u4ee5\u901a\u8fc7\u6253\u5f00Python\u6587\u4ef6\u540e\u4f7f\u7528<code>C-c C-c<\/code>\u547d\u4ee4\u6765\u6267\u884c\u5f53\u524d\u4ee3\u7801\u5757\uff0c\u6216\u8005\u4f7f\u7528<code>C-c C-z<\/code>\u8fdb\u5165Python\u4ea4\u4e92\u5f0f\u89e3\u91ca\u5668\u3002\u60a8\u4e5f\u53ef\u4ee5\u901a\u8fc7M-x run-python\u547d\u4ee4\u542f\u52a8\u4e00\u4e2aPython\u89e3\u91ca\u5668\uff0c\u5e76\u5728\u5176\u4e2d\u9010\u884c\u8f93\u5165\u4ee3\u7801\u8fdb\u884c\u6d4b\u8bd5\u548c\u8c03\u8bd5\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728Emacs\u4e2d\u8c03\u8bd5Python\u4ee3\u7801\uff1f<\/strong><br \/>\u8981\u5728Emacs\u4e2d\u8c03\u8bd5Python\u4ee3\u7801\uff0c\u53ef\u4ee5\u4f7f\u7528<code>pdb<\/code>\u8c03\u8bd5\u5de5\u5177\u3002\u901a\u8fc7\u5728Emacs\u4e2d\u8fd0\u884c<code>M-x pdb<\/code>\u547d\u4ee4\uff0c\u60a8\u53ef\u4ee5\u542f\u52a8Python\u8c03\u8bd5\u5668\uff0c\u5e76\u8f93\u5165\u8981\u8c03\u8bd5\u7684\u811a\u672c\u540d\u79f0\u3002\u4e4b\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528\u6807\u51c6\u7684\u8c03\u8bd5\u547d\u4ee4\uff0c\u5982\u8bbe\u7f6e\u65ad\u70b9\u3001\u5355\u6b65\u6267\u884c\u7b49\uff0c\u6765\u9010\u884c\u68c0\u67e5\u4ee3\u7801\u7684\u6267\u884c\u60c5\u51b5\u3002\u8fd9\u5bf9\u4e8e\u53d1\u73b0\u548c\u89e3\u51b3\u4ee3\u7801\u4e2d\u7684\u95ee\u9898\u975e\u5e38\u6709\u5e2e\u52a9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Emacs\u4e2d\u7f16\u8bd1Python\u4ee3\u7801\uff0c\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528\u5185\u7f6e\u7684\u7f16\u8bd1\u5668\u63a5\u53e3\u3001\u501f\u52a9\u5916\u90e8\u5de5\u5177\u5305\u3001\u6216\u914d\u7f6e\u9879\u76ee\u7279\u5b9a\u7684\u5de5\u4f5c\u6d41\u6765\u5b9e\u73b0 [&hellip;]","protected":false},"author":3,"featured_media":946345,"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\/946341"}],"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=946341"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/946341\/revisions"}],"predecessor-version":[{"id":946349,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/946341\/revisions\/946349"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/946345"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=946341"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=946341"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=946341"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}