{"id":1093969,"date":"2025-01-08T14:36:25","date_gmt":"2025-01-08T06:36:25","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1093969.html"},"modified":"2025-01-08T14:36:27","modified_gmt":"2025-01-08T06:36:27","slug":"%e4%bb%8ecmd%e5%a6%82%e4%bd%95%e6%9f%a5%e6%89%bepython%e7%9a%84%e5%ae%89%e8%a3%85%e8%b7%af%e5%be%84-3","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1093969.html","title":{"rendered":"\u4ececmd\u5982\u4f55\u67e5\u627epython\u7684\u5b89\u88c5\u8def\u5f84"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24210313\/2c009aab-fb78-4130-b4a3-5161b5c663ec.webp\" alt=\"\u4ececmd\u5982\u4f55\u67e5\u627epython\u7684\u5b89\u88c5\u8def\u5f84\" \/><\/p>\n<p><p> <strong>\u901a\u8fc7cmd\u67e5\u627epython\u7684\u5b89\u88c5\u8def\u5f84\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u51e0\u79cd\u65b9\u6cd5\uff1a\u4f7f\u7528where\u547d\u4ee4\u3001\u4f7f\u7528python\u547d\u4ee4\u3001\u68c0\u67e5\u73af\u5883\u53d8\u91cf\u3002<\/strong>\u5176\u4e2d\uff0c\u6700\u7b80\u5355\u7684\u65b9\u6cd5\u662f\u4f7f\u7528where\u547d\u4ee4\u6765\u67e5\u627ePython\u7684\u5b89\u88c5\u8def\u5f84\uff0c\u56e0\u4e3a\u5b83\u80fd\u591f\u76f4\u63a5\u8fd4\u56dePython\u53ef\u6267\u884c\u6587\u4ef6\u7684\u4f4d\u7f6e\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528WHERE\u547d\u4ee4<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528where\u547d\u4ee4\u662f\u67e5\u627ePython\u5b89\u88c5\u8def\u5f84\u7684\u6700\u76f4\u63a5\u65b9\u6cd5\u3002\u53ea\u9700\u5728cmd\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">where python<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6b64\u547d\u4ee4\u4f1a\u8fd4\u56dePython\u53ef\u6267\u884c\u6587\u4ef6\u7684\u5b8c\u6574\u8def\u5f84\u3002\u5982\u679c\u7cfb\u7edf\u4e2d\u5b89\u88c5\u4e86\u591a\u4e2a\u7248\u672c\u7684Python\uff0c\u5b83\u4f1a\u5217\u51fa\u6240\u6709\u5b89\u88c5\u8def\u5f84\u3002\u4e0b\u9762\u662f\u8be5\u65b9\u6cd5\u7684\u8be6\u7ec6\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08cmd\uff09\u3002<\/li>\n<li>\u8f93\u5165\u547d\u4ee4<code>where python<\/code>\u5e76\u6309\u56de\u8f66\u952e\u3002<\/li>\n<li>\u7cfb\u7edf\u4f1a\u8fd4\u56dePython\u53ef\u6267\u884c\u6587\u4ef6\u7684\u8def\u5f84\u3002<\/li>\n<\/ol>\n<p><p>\u793a\u4f8b\u8f93\u51fa\uff1a<\/p>\n<\/p>\n<p><pre><code>C:\\Users\\Username\\AppData\\Local\\Programs\\Python\\Python39\\python.exe<\/p>\n<p>C:\\Python39\\python.exe<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e8c\u3001\u4f7f\u7528PYTHON\u547d\u4ee4<\/h3>\n<\/p>\n<p><p>\u4f60\u8fd8\u53ef\u4ee5\u901a\u8fc7\u8fd0\u884cPython\u89e3\u91ca\u5668\u5e76\u6253\u5370\u5176\u5b89\u88c5\u8def\u5f84\u6765\u67e5\u627ePython\u7684\u5b89\u88c5\u4f4d\u7f6e\u3002\u4ee5\u4e0b\u662f\u5177\u4f53\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08cmd\uff09\u3002<\/li>\n<li>\u8f93\u5165\u547d\u4ee4<code>python<\/code>\u5e76\u6309\u56de\u8f66\u952e\u3002\u5982\u679c\u7cfb\u7edf\u4e2d\u5b89\u88c5\u4e86\u591a\u4e2a\u7248\u672c\u7684Python\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u4f7f\u7528<code>python3<\/code>\u3002<\/li>\n<li>\u8fdb\u5165Python\u4ea4\u4e92\u6a21\u5f0f\u540e\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u5e76\u6309\u56de\u8f66\u952e\uff1a\n<pre><code class=\"language-python\">import sys<\/p>\n<p>print(sys.executable)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u7cfb\u7edf\u4f1a\u8f93\u51faPython\u53ef\u6267\u884c\u6587\u4ef6\u7684\u5b8c\u6574\u8def\u5f84\u3002<\/li>\n<\/ol>\n<p><p>\u793a\u4f8b\u8f93\u51fa\uff1a<\/p>\n<\/p>\n<p><pre><code>C:\\Users\\Username\\AppData\\Local\\Programs\\Python\\Python39\\python.exe<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e09\u3001\u68c0\u67e5\u73af\u5883\u53d8\u91cf<\/h3>\n<\/p>\n<p><p>\u68c0\u67e5\u73af\u5883\u53d8\u91cf\u4e5f\u662f\u4e00\u79cd\u67e5\u627ePython\u5b89\u88c5\u8def\u5f84\u7684\u65b9\u6cd5\uff0c\u56e0\u4e3aPython\u7684\u5b89\u88c5\u8def\u5f84\u901a\u5e38\u4f1a\u88ab\u6dfb\u52a0\u5230\u7cfb\u7edf\u7684\u73af\u5883\u53d8\u91cf\u4e2d\u3002\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08cmd\uff09\u3002<\/li>\n<li>\u8f93\u5165\u547d\u4ee4<code>echo %PATH%<\/code>\u5e76\u6309\u56de\u8f66\u952e\u3002<\/li>\n<li>\u68c0\u67e5\u8f93\u51fa\u7684\u73af\u5883\u53d8\u91cf\u8def\u5f84\u5217\u8868\uff0c\u627e\u5230\u5305\u542b<code>Python<\/code>\u7684\u8def\u5f84\u3002<\/li>\n<\/ol>\n<p><p>\u793a\u4f8b\u8f93\u51fa\uff1a<\/p>\n<\/p>\n<p><pre><code>C:\\Users\\Username\\AppData\\Local\\Programs\\Python\\Python39\\Scripts\\;C:\\Users\\Username\\AppData\\Local\\Programs\\Python\\Python39\\;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u56db\u3001\u901a\u8fc7\u6ce8\u518c\u8868\u67e5\u627e<\/h3>\n<\/p>\n<p><p>\u5728Windows\u7cfb\u7edf\u4e2d\uff0cPython\u7684\u5b89\u88c5\u4fe1\u606f\u4e5f\u53ef\u80fd\u5b58\u50a8\u5728\u6ce8\u518c\u8868\u4e2d\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u67e5\u8be2\u6ce8\u518c\u8868\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">reg query &quot;HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore&quot; \/s<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6b64\u547d\u4ee4\u4f1a\u5217\u51fa\u6240\u6709\u5b89\u88c5\u5728\u7cfb\u7edf\u4e2d\u7684Python\u7248\u672c\u53ca\u5176\u5b89\u88c5\u8def\u5f84\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u901a\u8fc7\u4e0a\u8ff0\u65b9\u6cd5\uff0c\u4f60\u53ef\u4ee5\u8f7b\u677e\u67e5\u627e\u5230Python\u7684\u5b89\u88c5\u8def\u5f84\u3002\u65e0\u8bba\u662f\u4f7f\u7528where\u547d\u4ee4\u3001python\u547d\u4ee4\uff0c\u8fd8\u662f\u68c0\u67e5\u73af\u5883\u53d8\u91cf\u548c\u6ce8\u518c\u8868\uff0c\u90fd\u80fd\u5e2e\u52a9\u4f60\u5feb\u901f\u5b9a\u4f4dPython\u7684\u5b89\u88c5\u4f4d\u7f6e\u3002\u8fd9\u4e9b\u65b9\u6cd5\u5404\u6709\u4f18\u52a3\uff0c\u5177\u4f53\u9009\u62e9\u54ea\u79cd\u65b9\u6cd5\u53ef\u4ee5\u6839\u636e\u4f60\u7684\u5b9e\u9645\u9700\u6c42\u548c\u4f7f\u7528\u4e60\u60ef\u6765\u51b3\u5b9a\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 \/>\u8981\u68c0\u67e5Python\u662f\u5426\u5df2\u5b89\u88c5\uff0c\u53ef\u4ee5\u5728CMD\u4e2d\u8f93\u5165<code>python --version<\/code>\u6216<code>python -V<\/code>\u3002\u5982\u679cPython\u5df2\u6b63\u786e\u5b89\u88c5\uff0c\u8fd9\u5c06\u8fd4\u56de\u60a8\u5b89\u88c5\u7684Python\u7248\u672c\u53f7\u3002\u5982\u679c\u6ca1\u6709\u5b89\u88c5\uff0c\u60a8\u5c06\u770b\u5230\u76f8\u5e94\u7684\u9519\u8bef\u6d88\u606f\u3002<\/p>\n<p><strong>\u5982\u679c\u627e\u4e0d\u5230Python\uff0c\u662f\u5426\u6709\u5176\u4ed6\u65b9\u6cd5\u53ef\u4ee5\u67e5\u627e\u5176\u5b89\u88c5\u8def\u5f84\uff1f<\/strong><br \/>\u662f\u7684\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528Windows\u6587\u4ef6<a href=\"https:\/\/docs.pingcode.com\/blog\/project-management\/58557.html\" target=\"_blank\">\u8d44\u6e90\u7ba1\u7406<\/a>\u5668\u8fdb\u884c\u67e5\u627e\u3002\u901a\u5e38\uff0cPython\u4f1a\u5b89\u88c5\u5728<code>C:\\PythonXX<\/code>\uff08XX\u4ee3\u8868\u7248\u672c\u53f7\uff09\u6216<code>C:\\Users\\\u7528\u6237\u540d\\AppData\\Local\\Programs\\Python\\PythonXX<\/code>\u76ee\u5f55\u4e2d\u3002\u60a8\u53ef\u4ee5\u901a\u8fc7\u641c\u7d22\u201cPython\u201d\u5173\u952e\u5b57\u6765\u5b9a\u4f4d\u5b89\u88c5\u76ee\u5f55\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728CMD\u4e2d\u67e5\u627ePython\u7684\u5177\u4f53\u6267\u884c\u8def\u5f84\uff1f<\/strong><br \/>\u5728CMD\u4e2d\u8f93\u5165<code>where python<\/code>\u547d\u4ee4\u5c06\u663e\u793aPython\u53ef\u6267\u884c\u6587\u4ef6\u7684\u5b8c\u6574\u8def\u5f84\u3002\u5982\u679c\u7cfb\u7edf\u4e2d\u5b89\u88c5\u4e86\u591a\u4e2a\u7248\u672c\u7684Python\uff0c\u8be5\u547d\u4ee4\u4f1a\u5217\u51fa\u6240\u6709\u5b89\u88c5\u8def\u5f84\uff0c\u65b9\u4fbf\u7528\u6237\u9009\u62e9\u4f7f\u7528\u7279\u5b9a\u7248\u672c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u901a\u8fc7cmd\u67e5\u627epython\u7684\u5b89\u88c5\u8def\u5f84\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u51e0\u79cd\u65b9\u6cd5\uff1a\u4f7f\u7528where\u547d\u4ee4\u3001\u4f7f\u7528python\u547d\u4ee4\u3001\u68c0\u67e5\u73af [&hellip;]","protected":false},"author":3,"featured_media":1093980,"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\/1093969"}],"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=1093969"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1093969\/revisions"}],"predecessor-version":[{"id":1093983,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1093969\/revisions\/1093983"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1093980"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1093969"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1093969"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1093969"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}