{"id":993672,"date":"2024-12-27T08:48:00","date_gmt":"2024-12-27T00:48:00","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/993672.html"},"modified":"2024-12-27T08:48:03","modified_gmt":"2024-12-27T00:48:03","slug":"cmd%e5%a6%82%e4%bd%95%e6%89%bepython%e7%9b%ae%e5%bd%95","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/993672.html","title":{"rendered":"cmd\u5982\u4f55\u627epython\u76ee\u5f55"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25071003\/295fdaab-394d-4065-bfb7-27de02a0402a.webp\" alt=\"cmd\u5982\u4f55\u627epython\u76ee\u5f55\" \/><\/p>\n<p><p> <strong>\u5728Windows\u64cd\u4f5c\u7cfb\u7edf\u7684\u547d\u4ee4\u63d0\u793a\u7b26\uff08CMD\uff09\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528\u201cwhere\u201d\u547d\u4ee4\u3001\u68c0\u67e5\u73af\u5883\u53d8\u91cf\u3001\u4f7f\u7528Python\u547d\u4ee4\u884c\u3001\u6ce8\u518c\u8868\u67e5\u8be2\u7b49\u65b9\u6cd5\u6765\u627e\u51faPython\u7684\u5b89\u88c5\u76ee\u5f55\u3002<\/strong>\u6700\u7b80\u5355\u7684\u65b9\u6cd5\u662f\u4f7f\u7528\u201cwhere\u201d\u547d\u4ee4\uff0c\u56e0\u4e3a\u5b83\u76f4\u63a5\u8fd4\u56dePython\u53ef\u6267\u884c\u6587\u4ef6\u7684\u8def\u5f84\u3002\u4ee5\u4e0b\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u8fd9\u4e9b\u65b9\u6cd5\u7684\u64cd\u4f5c\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001WHERE\u547d\u4ee4<\/p>\n<\/p>\n<p><p>\u201cwhere\u201d\u547d\u4ee4\u5728CMD\u4e2d\u7528\u4e8e\u67e5\u627e\u53ef\u6267\u884c\u6587\u4ef6\u7684\u8def\u5f84\uff0c\u5305\u62ecPython\u3002<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08CMD\uff09\uff1a\u6309\u4e0b\u201cWin + R\u201d\u7ec4\u5408\u952e\uff0c\u8f93\u5165\u201ccmd\u201d\u5e76\u6309\u4e0b\u201cEnter\u201d\u952e\u3002<\/li>\n<li>\u8f93\u5165\u547d\u4ee4\uff1a<code>where python<\/code>\uff0c\u7136\u540e\u6309\u4e0b\u201cEnter\u201d\u952e\u3002<\/li>\n<li>\u8f93\u51fa\u7ed3\u679c\u5c06\u663e\u793aPython\u53ef\u6267\u884c\u6587\u4ef6\u7684\u8def\u5f84\u3002\u6b64\u8def\u5f84\u5373\u4e3aPython\u7684\u5b89\u88c5\u76ee\u5f55\u3002<\/li>\n<\/ol>\n<p><p>\u8fd9\u79cd\u65b9\u6cd5\u7684\u4f18\u70b9\u5728\u4e8e\u7b80\u5355\u5feb\u6377\uff0c\u4f46\u524d\u63d0\u662fPython\u8def\u5f84\u5df2\u7ecf\u6dfb\u52a0\u5230\u7cfb\u7edf\u7684\u73af\u5883\u53d8\u91cf\u4e2d\u3002<\/p>\n<\/p>\n<p><p>\u4e8c\u3001\u68c0\u67e5\u73af\u5883\u53d8\u91cf<\/p>\n<\/p>\n<p><p>\u73af\u5883\u53d8\u91cf\u662f\u64cd\u4f5c\u7cfb\u7edf\u7528\u4e8e\u5b58\u50a8\u7a0b\u5e8f\u6267\u884c\u8def\u5f84\u7684\u4fe1\u606f\uff0c\u901a\u8fc7\u547d\u4ee4\u884c\u53ef\u4ee5\u67e5\u770bPython\u6240\u5728\u7684\u8def\u5f84\u3002<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08CMD\uff09\uff0c\u8f93\u5165\uff1a<code>echo %PATH%<\/code>\uff0c\u6309\u4e0b\u201cEnter\u201d\u3002<\/li>\n<li>\u5728\u8f93\u51fa\u7684\u73af\u5883\u53d8\u91cf\u8def\u5f84\u4e2d\u67e5\u627e\u4e0ePython\u76f8\u5173\u7684\u8def\u5f84\u3002\u901a\u5e38\u4f1a\u663e\u793aPython\u7684\u5b89\u88c5\u76ee\u5f55\u3002<\/li>\n<\/ol>\n<p><p>\u5982\u679c\u6ca1\u6709\u627e\u5230Python\u8def\u5f84\uff0c\u53ef\u80fd\u9700\u8981\u624b\u52a8\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3002<\/p>\n<\/p>\n<p><p>\u4e09\u3001\u4f7f\u7528Python\u547d\u4ee4\u884c<\/p>\n<\/p>\n<p><p>\u901a\u8fc7Python\u547d\u4ee4\u884c\uff0c\u53ef\u4ee5\u83b7\u53d6Python\u7684\u5b89\u88c5\u76ee\u5f55\u3002<\/p>\n<\/p>\n<ol>\n<li>\u5728CMD\u4e2d\u8f93\u5165\uff1a<code>python<\/code>\uff0c\u6309\u4e0b\u201cEnter\u201d\u8fdb\u5165Python\u4ea4\u4e92\u6a21\u5f0f\u3002<\/li>\n<li>\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<code>import sys; print(sys.executable)<\/code>\uff0c\u7136\u540e\u6309\u4e0b\u201cEnter\u201d\u3002<\/li>\n<li>\u8f93\u51fa\u7684\u8def\u5f84\u5373\u4e3aPython\u7684\u53ef\u6267\u884c\u6587\u4ef6\u8def\u5f84\uff0c\u901a\u5e38\u662fPython\u7684\u5b89\u88c5\u76ee\u5f55\u3002<\/li>\n<\/ol>\n<p><p>\u8fd9\u79cd\u65b9\u6cd5\u4f9d\u8d56\u4e8ePython\u5df2\u7ecf\u6b63\u786e\u5b89\u88c5\u5e76\u914d\u7f6e\u3002<\/p>\n<\/p>\n<p><p>\u56db\u3001\u6ce8\u518c\u8868\u67e5\u8be2<\/p>\n<\/p>\n<p><p>Python\u5b89\u88c5\u65f6\u4f1a\u5728Windows\u6ce8\u518c\u8868\u4e2d\u8bb0\u5f55\u5b89\u88c5\u8def\u5f84\uff0c\u53ef\u4ee5\u901a\u8fc7\u67e5\u8be2\u6ce8\u518c\u8868\u83b7\u53d6\u3002<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u201c\u8fd0\u884c\u201d\u7a97\u53e3\uff0c\u8f93\u5165\u201cregedit\u201d\uff0c\u6309\u4e0b\u201cEnter\u201d\u952e\uff0c\u8fdb\u5165\u6ce8\u518c\u8868\u7f16\u8f91\u5668\u3002<\/li>\n<li>\u5bfc\u822a\u5230<code>HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore<\/code>\uff0c\u5728\u6b64\u8def\u5f84\u4e0b\u67e5\u627e\u7279\u5b9a\u7248\u672c\u7684\u5b89\u88c5\u4fe1\u606f\u3002<\/li>\n<li>\u901a\u8fc7\u67e5\u770b\u201cInstallPath\u201d\u9879\u7684\u503c\uff0c\u53ef\u4ee5\u786e\u5b9aPython\u7684\u5b89\u88c5\u76ee\u5f55\u3002<\/li>\n<\/ol>\n<p><p>\u8fd9\u79cd\u65b9\u6cd5\u9002\u7528\u4e8e\u9700\u8981\u6df1\u5165\u7cfb\u7edf\u5185\u90e8\u67e5\u770bPython\u5b89\u88c5\u4fe1\u606f\u7684\u7528\u6237\u3002<\/p>\n<\/p>\n<p><p>\u4e94\u3001\u624b\u52a8\u67e5\u627e<\/p>\n<\/p>\n<p><p>\u5982\u679c\u4ee5\u4e0a\u65b9\u6cd5\u90fd\u672a\u80fd\u627e\u5230Python\u76ee\u5f55\uff0c\u53ef\u4ee5\u901a\u8fc7\u624b\u52a8\u67e5\u627e\u3002<\/p>\n<\/p>\n<ol>\n<li>\u901a\u5e38Python\u9ed8\u8ba4\u5b89\u88c5\u5728<code>C:\\Users\\&lt;\u7528\u6237\u540d&gt;\\AppData\\Local\\Programs\\Python<\/code>\u6216<code>C:\\PythonXX<\/code>\uff08XX\u662fPython\u7248\u672c\u53f7\uff09\u3002<\/li>\n<li>\u901a\u8fc7<a href=\"https:\/\/docs.pingcode.com\/blog\/project-management\/58557.html\" target=\"_blank\">\u8d44\u6e90\u7ba1\u7406<\/a>\u5668\u5bfc\u822a\u5230\u4e0a\u8ff0\u8def\u5f84\uff0c\u67e5\u770b\u662f\u5426\u5b58\u5728Python\u5b89\u88c5\u76ee\u5f55\u3002<\/li>\n<\/ol>\n<p><p>\u8fd9\u79cd\u65b9\u6cd5\u9002\u7528\u4e8e\u5bf9\u8ba1\u7b97\u673a\u6587\u4ef6\u7cfb\u7edf\u7ed3\u6784\u719f\u6089\u7684\u7528\u6237\u3002<\/p>\n<\/p>\n<p><p>\u516d\u3001\u786e\u8ba4Python\u7248\u672c<\/p>\n<\/p>\n<p><p>\u5728\u786e\u5b9aPython\u76ee\u5f55\u540e\uff0c\u5efa\u8bae\u786e\u8ba4\u5b89\u88c5\u7684Python\u7248\u672c\uff0c\u4ee5\u4fbf\u4e8e\u540e\u7eed\u4f7f\u7528\u3002<\/p>\n<\/p>\n<ol>\n<li>\u5728CMD\u4e2d\u8f93\u5165\uff1a<code>python --version<\/code>\uff0c\u6309\u4e0b\u201cEnter\u201d\u3002<\/li>\n<li>\u8f93\u51fa\u7ed3\u679c\u5c06\u663e\u793a\u5f53\u524d\u4f7f\u7528\u7684Python\u7248\u672c\u3002<\/li>\n<\/ol>\n<p><p>\u786e\u8ba4Python\u7248\u672c\u6709\u52a9\u4e8e\u786e\u4fdd\u7a0b\u5e8f\u4e0ePython\u7248\u672c\u7684\u517c\u5bb9\u6027\u3002<\/p>\n<\/p>\n<p><p>\u4e03\u3001\u603b\u7ed3<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u4e0a\u8ff0\u51e0\u79cd\u65b9\u6cd5\uff0c\u7528\u6237\u53ef\u4ee5\u5728Windows\u7cfb\u7edf\u4e2d\u8f7b\u677e\u627e\u5230Python\u7684\u5b89\u88c5\u76ee\u5f55\u3002\u9009\u62e9\u6700\u9002\u5408\u7684\u65b9\u5f0f\uff0c\u6839\u636e\u9700\u6c42\u83b7\u53d6Python\u8def\u5f84\u4fe1\u606f\uff0c\u786e\u4fddPython\u5f00\u53d1\u73af\u5883\u7684\u6b63\u5e38\u4f7f\u7528\u3002\u65e0\u8bba\u662f\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177\u8fd8\u662f\u6ce8\u518c\u8868\u67e5\u8be2\uff0c\u90fd\u80fd\u6709\u6548\u5730\u5e2e\u52a9\u7528\u6237\u5b9a\u4f4dPython\u7684\u5b89\u88c5\u4f4d\u7f6e\uff0c\u652f\u6301Python\u7a0b\u5e8f\u7684\u5f00\u53d1\u548c\u8fd0\u884c\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728CMD\u4e2d\u786e\u8ba4Python\u662f\u5426\u5df2\u5b89\u88c5\uff1f<\/strong><br \/>\u5728CMD\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u8f93\u5165<code>python --version<\/code>\u6216<code>python -V<\/code>\u6765\u68c0\u67e5Python\u662f\u5426\u5df2\u5b89\u88c5\u3002\u5982\u679cPython\u5df2\u5b89\u88c5\uff0c\u8fd9\u4e2a\u547d\u4ee4\u5c06\u8fd4\u56de\u5f53\u524d\u5b89\u88c5\u7684Python\u7248\u672c\u53f7\u3002\u5982\u679c\u63d0\u793a\u627e\u4e0d\u5230\u547d\u4ee4\uff0c\u53ef\u80fd\u9700\u8981\u5b89\u88c5Python\u6216\u68c0\u67e5\u7cfb\u7edf\u8def\u5f84\u8bbe\u7f6e\u3002<\/p>\n<p><strong>\u5982\u679cCMD\u4e2d\u627e\u4e0d\u5230Python\uff0c\u6211\u8be5\u5982\u4f55\u5b89\u88c5\uff1f<\/strong><br \/>\u82e5CMD\u4e2d\u65e0\u6cd5\u627e\u5230Python\uff0c\u53ef\u4ee5\u8bbf\u95eePython\u7684\u5b98\u65b9\u7f51\u7ad9\uff08python.org\uff09\u4e0b\u8f7d\u6700\u65b0\u7248\u672c\u7684Python\u5b89\u88c5\u7a0b\u5e8f\u3002\u5b89\u88c5\u65f6\uff0c\u8bf7\u786e\u4fdd\u52fe\u9009\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u8fd9\u6837Python\u7684\u76ee\u5f55\u5c31\u4f1a\u81ea\u52a8\u6dfb\u52a0\u5230\u7cfb\u7edf\u8def\u5f84\u4e2d\uff0c\u4ece\u800c\u53ef\u4ee5\u5728CMD\u4e2d\u76f4\u63a5\u8bbf\u95ee\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728CMD\u4e2d\u67e5\u770bPython\u7684\u5b89\u88c5\u76ee\u5f55\uff1f<\/strong><br \/>\u53ef\u4ee5\u5728CMD\u4e2d\u8f93\u5165<code>where python<\/code>\u547d\u4ee4\u6765\u67e5\u627ePython\u7684\u5b89\u88c5\u76ee\u5f55\u3002\u6b64\u547d\u4ee4\u5c06\u8fd4\u56dePython\u53ef\u6267\u884c\u6587\u4ef6\u7684\u8def\u5f84\uff0c\u901a\u5e38\u662f\u5728Python\u5b89\u88c5\u7684\u6839\u76ee\u5f55\u4e0b\u3002\u5982\u679c\u8fd4\u56de\u4e3a\u7a7a\uff0c\u53ef\u80fd\u9700\u8981\u68c0\u67e5Python\u662f\u5426\u6b63\u786e\u5b89\u88c5\u6216\u8def\u5f84\u8bbe\u7f6e\u662f\u5426\u6709\u8bef\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Windows\u64cd\u4f5c\u7cfb\u7edf\u7684\u547d\u4ee4\u63d0\u793a\u7b26\uff08CMD\uff09\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528\u201cwhere\u201d\u547d\u4ee4\u3001\u68c0\u67e5\u73af\u5883\u53d8\u91cf\u3001\u4f7f\u7528Pytho [&hellip;]","protected":false},"author":3,"featured_media":993687,"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\/993672"}],"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=993672"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/993672\/revisions"}],"predecessor-version":[{"id":993690,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/993672\/revisions\/993690"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/993687"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=993672"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=993672"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=993672"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}