{"id":982160,"date":"2024-12-27T07:08:32","date_gmt":"2024-12-26T23:08:32","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/982160.html"},"modified":"2024-12-27T07:08:34","modified_gmt":"2024-12-26T23:08:34","slug":"%e5%a6%82%e4%bd%95%e6%89%93%e5%bc%80python-cmd%e7%aa%97%e5%8f%a3","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/982160.html","title":{"rendered":"\u5982\u4f55\u6253\u5f00python cmd\u7a97\u53e3"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24210754\/6a64f2d3-d81b-4eda-8ec5-dd76f2ca4c4b.webp\" alt=\"\u5982\u4f55\u6253\u5f00python cmd\u7a97\u53e3\" \/><\/p>\n<p><p> <strong>\u8981\u6253\u5f00Python CMD\u7a97\u53e3\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u51e0\u79cd\u65b9\u6cd5\uff1a\u4f7f\u7528\u547d\u4ee4\u63d0\u793a\u7b26\u3001\u4f7f\u7528Windows\u641c\u7d22\u3001\u4f7f\u7528Anaconda Prompt\u6216\u5176\u4ed6IDE\u3002<\/strong> \u5176\u4e2d\uff0c\u6700\u5e38\u7528\u7684\u65b9\u6cd5\u662f\u901a\u8fc7\u547d\u4ee4\u63d0\u793a\u7b26\u76f4\u63a5\u6253\u5f00\u3002\u9996\u5148\uff0c\u786e\u4fdd\u5df2\u7ecf\u5728\u7cfb\u7edf\u4e0a\u6b63\u786e\u5b89\u88c5\u4e86Python\uff0c\u5e76\u5c06Python\u7684\u8def\u5f84\u6dfb\u52a0\u5230\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u4e2d\u3002\u7136\u540e\uff0c\u901a\u8fc7Windows\u641c\u7d22\u529f\u80fd\u67e5\u627e\u201c\u547d\u4ee4\u63d0\u793a\u7b26\u201d\u6216\u76f4\u63a5\u5728\u8fd0\u884c\u6846\u4e2d\u8f93\u5165\u201ccmd\u201d\u5e76\u56de\u8f66\u5373\u53ef\u6253\u5f00\u3002\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u7a97\u53e3\u4e2d\uff0c\u8f93\u5165\u201cpython\u201d\u5e76\u56de\u8f66\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u8fdb\u5165Python\u4ea4\u4e92\u5f0f\u73af\u5883\uff0c\u5f00\u59cb\u7f16\u5199\u548c\u8fd0\u884cPython\u4ee3\u7801\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u4f7f\u7528\u547d\u4ee4\u63d0\u793a\u7b26\u6253\u5f00Python<\/p>\n<\/p>\n<p><p>\u4f7f\u7528\u547d\u4ee4\u63d0\u793a\u7b26\uff08CMD\uff09\u6253\u5f00Python\u662f\u6700\u57fa\u7840\u7684\u64cd\u4f5c\u4e4b\u4e00\uff0c\u4e5f\u662f\u5b66\u4e60Python\u7f16\u7a0b\u7684\u7b2c\u4e00\u6b65\u3002\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff1a<\/strong> \u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u3002\u6700\u7b80\u5355\u7684\u65b9\u6cd5\u662f\u5728\u641c\u7d22\u6846\u4e2d\u8f93\u5165\u201ccmd\u201d\u5e76\u6309\u4e0b\u56de\u8f66\u952e\u3002\u6b64\u5916\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u5feb\u6377\u952e\u201cWindows + R\u201d\u6253\u5f00\u8fd0\u884c\u7a97\u53e3\uff0c\u7136\u540e\u8f93\u5165\u201ccmd\u201d\u5e76\u6309\u4e0b\u56de\u8f66\u952e\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u9a8c\u8bc1Python\u5b89\u88c5\uff1a<\/strong> \u5728\u547d\u4ee4\u63d0\u793a\u7b26\u7a97\u53e3\u4e2d\u8f93\u5165\u201cpython &#8211;version\u201d\u6216\u201cpython -V\u201d\u6765\u68c0\u67e5Python\u662f\u5426\u6b63\u786e\u5b89\u88c5\u3002\u5982\u679c\u663e\u793aPython\u7684\u7248\u672c\u53f7\uff0c\u8bf4\u660ePython\u5df2\u6210\u529f\u5b89\u88c5\u3002\u5982\u679c\u51fa\u73b0\u9519\u8bef\u4fe1\u606f\uff0c\u5219\u9700\u8981\u68c0\u67e5Python\u7684\u5b89\u88c5\u8def\u5f84\u662f\u5426\u5df2\u6dfb\u52a0\u5230\u7cfb\u7edf\u7684\u73af\u5883\u53d8\u91cf\u4e2d\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8fdb\u5165Python\u4ea4\u4e92\u5f0f\u73af\u5883\uff1a<\/strong> \u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8f93\u5165\u201cpython\u201d\u5e76\u6309\u4e0b\u56de\u8f66\u952e\uff0c\u5373\u53ef\u8fdb\u5165Python\u4ea4\u4e92\u5f0f\u73af\u5883\u3002\u5728\u8fd9\u91cc\uff0c\u4f60\u53ef\u4ee5\u76f4\u63a5\u8f93\u5165Python\u4ee3\u7801\u5e76\u6267\u884c\u3002\u8fd9\u79cd\u4ea4\u4e92\u5f0f\u73af\u5883\u5bf9\u4e8e\u6d4b\u8bd5\u5c0f\u6bb5\u4ee3\u7801\u548c\u5b66\u4e60Python\u57fa\u7840\u77e5\u8bc6\u975e\u5e38\u6709\u7528\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e8c\u3001\u901a\u8fc7Windows\u641c\u7d22\u6253\u5f00Python<\/p>\n<\/p>\n<p><p>\u53e6\u4e00\u79cd\u5feb\u901f\u6253\u5f00Python\u7684\u65b9\u6cd5\u662f\u76f4\u63a5\u901a\u8fc7Windows\u7684\u641c\u7d22\u529f\u80fd\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4f7f\u7528Windows\u641c\u7d22\uff1a<\/strong> \u70b9\u51fb\u4efb\u52a1\u680f\u4e0a\u7684\u641c\u7d22\u56fe\u6807\uff08\u6216\u6309\u4e0b\u201cWindows + S\u201d\uff09\uff0c\u7136\u540e\u5728\u641c\u7d22\u6846\u4e2d\u8f93\u5165\u201cPython\u201d\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u9009\u62e9Python\u5e94\u7528\uff1a<\/strong> \u5728\u641c\u7d22\u7ed3\u679c\u4e2d\uff0c\u4f60\u4f1a\u770b\u5230\u4e0ePython\u76f8\u5173\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u5982\u201cPython 3.x\uff08x64\uff09\u201d\u7b49\u3002\u70b9\u51fb\u76f8\u5e94\u7684\u5e94\u7528\u7a0b\u5e8f\u5373\u53ef\u6253\u5f00Python\u4ea4\u4e92\u5f0f\u7a97\u53e3\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6267\u884cPython\u4ee3\u7801\uff1a<\/strong> \u6253\u5f00\u540e\uff0c\u4f60\u4f1a\u770b\u5230\u4e00\u4e2a\u7c7b\u4f3c\u547d\u4ee4\u63d0\u793a\u7b26\u7684\u7a97\u53e3\uff0c\u79f0\u4e3aPython Shell\u3002\u5728\u8fd9\u91cc\uff0c\u4f60\u53ef\u4ee5\u76f4\u63a5\u8f93\u5165\u548c\u6267\u884cPython\u4ee3\u7801\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001\u4f7f\u7528Anaconda Prompt<\/p>\n<\/p>\n<p><p>\u5982\u679c\u4f60\u5b89\u88c5\u4e86Anaconda\uff0cAnaconda Prompt\u662f\u4e00\u4e2a\u65b9\u4fbf\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u7528\u4e8e\u6253\u5f00Python\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u542f\u52a8Anaconda Prompt\uff1a<\/strong> \u5728Windows\u641c\u7d22\u6846\u4e2d\u8f93\u5165\u201cAnaconda Prompt\u201d\u5e76\u56de\u8f66\uff0c\u6216\u8005\u4ece\u5f00\u59cb\u83dc\u5355\u4e2d\u9009\u62e9Anaconda Prompt\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8fdb\u5165Python\u73af\u5883\uff1a<\/strong> \u5728Anaconda Prompt\u4e2d\u8f93\u5165\u201cpython\u201d\u5e76\u6309\u4e0b\u56de\u8f66\u952e\uff0c\u5373\u53ef\u8fdb\u5165Python\u4ea4\u4e92\u5f0f\u73af\u5883\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7ba1\u7406\u865a\u62df\u73af\u5883\uff1a<\/strong> \u4f7f\u7528Anaconda\uff0c\u4f60\u8fd8\u53ef\u4ee5\u8f7b\u677e\u7ba1\u7406\u591a\u4e2aPython\u865a\u62df\u73af\u5883\uff0c\u8fd9\u5bf9\u4e8e\u5f00\u53d1\u591a\u4e2a\u9879\u76ee\u975e\u5e38\u6709\u7528\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u56db\u3001\u901a\u8fc7IDE\u6253\u5f00Python<\/p>\n<\/p>\n<p><p>\u8bb8\u591a\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u90fd\u63d0\u4f9b\u4e86\u4fbf\u6377\u7684Python\u7f16\u7a0b\u73af\u5883\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u9009\u62e9\u5408\u9002\u7684IDE\uff1a<\/strong> \u5e38\u7528\u7684Python IDE\u5305\u62ecPyCharm\u3001VS Code\u3001Spyder\u7b49\u3002\u8fd9\u4e9b\u5de5\u5177\u901a\u5e38\u63d0\u4f9b\u4e86\u66f4\u5f3a\u5927\u7684\u8c03\u8bd5\u548c\u5f00\u53d1\u529f\u80fd\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u914d\u7f6ePython\u89e3\u91ca\u5668\uff1a<\/strong> \u5728IDE\u4e2d\u914d\u7f6ePython\u89e3\u91ca\u5668\u8def\u5f84\uff0c\u4ee5\u4fbf\u6b63\u786e\u6267\u884cPython\u4ee3\u7801\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8fd0\u884cPython\u4ee3\u7801\uff1a<\/strong> \u5728IDE\u4e2d\u521b\u5efa\u65b0\u7684Python\u6587\u4ef6\u6216\u6253\u5f00\u73b0\u6709\u6587\u4ef6\uff0c\u7136\u540e\u8fd0\u884c\u4ee3\u7801\u3002\u8fd9\u4e9bIDE\u901a\u5e38\u96c6\u6210\u4e86\u7ec8\u7aef\u7a97\u53e3\uff0c\u4fbf\u4e8e\u6267\u884cPython\u4ee3\u7801\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4ee5\u4e0a\u56db\u79cd\u65b9\u6cd5\u63d0\u4f9b\u4e86\u591a\u79cd\u6253\u5f00Python CMD\u7a97\u53e3\u7684\u9014\u5f84\uff0c\u6bcf\u79cd\u65b9\u6cd5\u90fd\u6709\u5176\u7279\u5b9a\u7684\u573a\u666f\u548c\u4f18\u7f3a\u70b9\u3002\u9009\u62e9\u9002\u5408\u81ea\u5df1\u7684\u65b9\u6cd5\uff0c\u80fd\u591f\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u548c\u5b66\u4e60\u6548\u679c\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Windows\u4e0a\u627e\u5230\u5e76\u6253\u5f00Python\u7684\u547d\u4ee4\u63d0\u793a\u7b26\uff1f<\/strong><br \/>\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\u627e\u5230Python\u7684\u547d\u4ee4\u63d0\u793a\u7b26\u3002\u9996\u5148\uff0c\u60a8\u53ef\u4ee5\u5728\u5f00\u59cb\u83dc\u5355\u4e2d\u641c\u7d22\u201ccmd\u201d\u6216\u8005\u201c\u547d\u4ee4\u63d0\u793a\u7b26\u201d\uff0c\u7136\u540e\u5728\u6253\u5f00\u7684\u7a97\u53e3\u4e2d\u8f93\u5165\u201cpython\u201d\u4ee5\u542f\u52a8Python\u89e3\u91ca\u5668\u3002\u5982\u679c\u60a8\u5b89\u88c5\u4e86Anaconda\uff0c\u53ef\u4ee5\u5728\u5f00\u59cb\u83dc\u5355\u4e2d\u627e\u5230Anaconda Prompt\uff0c\u76f4\u63a5\u6253\u5f00\u540e\u4e5f\u53ef\u4ee5\u4f7f\u7528Python\u547d\u4ee4\u3002<\/p>\n<p><strong>\u5728Mac\u6216Linux\u7cfb\u7edf\u4e2d\u5982\u4f55\u6253\u5f00Python\u547d\u4ee4\u884c\uff1f<\/strong><br \/>\u5728Mac\u6216Linux\u7cfb\u7edf\u4e0a\uff0c\u6253\u5f00\u7ec8\u7aef\u5e94\u7528\u7a0b\u5e8f\u540e\uff0c\u53ea\u9700\u8f93\u5165\u201cpython3\u201d\u6216\u201cpython\u201d\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u60a8\u5b89\u88c5\u7684Python\u7248\u672c\u3002\u82e5\u7cfb\u7edf\u4e2d\u9ed8\u8ba4Python\u7248\u672c\u4e3a2.x\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u4f7f\u7528\u201cpython3\u201d\u6765\u542f\u52a8Python 3.x\u7248\u672c\u7684\u547d\u4ee4\u884c\u3002<\/p>\n<p><strong>\u4f7f\u7528Python\u865a\u62df\u73af\u5883\u65f6\uff0c\u5982\u4f55\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff1f<\/strong><br \/>\u5f53\u60a8\u5728\u4f7f\u7528Python\u865a\u62df\u73af\u5883\u65f6\uff0c\u53ef\u4ee5\u5148\u6fc0\u6d3b\u8be5\u73af\u5883\u3002\u4f8b\u5982\uff0c\u4f7f\u7528<code>source venv\/bin\/activate<\/code>\uff08Linux\/Mac\uff09\u6216<code>venv\\Scripts\\activate<\/code>\uff08Windows\uff09\u547d\u4ee4\u6fc0\u6d3b\u540e\uff0c\u60a8\u5c06\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u770b\u5230\u73af\u5883\u540d\u79f0\u7684\u524d\u7f00\u3002\u63a5\u4e0b\u6765\uff0c\u76f4\u63a5\u5728\u8be5\u73af\u5883\u4e0b\u8f93\u5165\u201cpython\u201d\u5373\u53ef\u6253\u5f00\u8be5\u865a\u62df\u73af\u5883\u7684Python\u547d\u4ee4\u884c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u6253\u5f00Python CMD\u7a97\u53e3\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u51e0\u79cd\u65b9\u6cd5\uff1a\u4f7f\u7528\u547d\u4ee4\u63d0\u793a\u7b26\u3001\u4f7f\u7528Windows\u641c\u7d22\u3001\u4f7f\u7528Anacon [&hellip;]","protected":false},"author":3,"featured_media":982167,"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\/982160"}],"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=982160"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/982160\/revisions"}],"predecessor-version":[{"id":982168,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/982160\/revisions\/982168"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/982167"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=982160"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=982160"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=982160"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}