{"id":1038865,"date":"2024-12-31T12:27:45","date_gmt":"2024-12-31T04:27:45","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1038865.html"},"modified":"2024-12-31T12:27:47","modified_gmt":"2024-12-31T04:27:47","slug":"%e5%a6%82%e4%bd%95%e8%ae%be%e7%bd%ae%e6%9c%89%e5%85%b3python%e7%9a%84%e6%b3%a8%e5%86%8c%e8%a1%a8","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1038865.html","title":{"rendered":"\u5982\u4f55\u8bbe\u7f6e\u6709\u5173Python\u7684\u6ce8\u518c\u8868"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-docs.pingcode.com\/wp-content\/uploads\/2024\/12\/2bb1db02-0172-4b67-ba8f-62bc96b1c318.webp?x-oss-process=image\/auto-orient,1\/format,webp\" alt=\"\u5982\u4f55\u8bbe\u7f6e\u6709\u5173Python\u7684\u6ce8\u518c\u8868\" \/><\/p>\n<p><p> <strong>\u8bbe\u7f6e\u6709\u5173Python\u7684\u6ce8\u518c\u8868\uff0c\u9996\u5148\u9700\u8981\u786e\u4fdd\u4f60\u5df2\u7ecf\u5728\u7cfb\u7edf\u4e0a\u5b89\u88c5\u4e86Python\u3002\u7136\u540e\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7Windows\u6ce8\u518c\u8868\u7f16\u8f91\u5668\uff08regedit\uff09\u6765\u6dfb\u52a0\u6216\u4fee\u6539\u6ce8\u518c\u8868\u9879\uff0c\u4ee5\u914d\u7f6ePython\u7684\u8def\u5f84\u3001\u7248\u672c\u7b49\u4fe1\u606f\u3002\u5177\u4f53\u6b65\u9aa4\u5305\u62ec\uff1a\u6253\u5f00\u6ce8\u518c\u8868\u7f16\u8f91\u5668\u3001\u5b9a\u4f4d\u5230\u76f8\u5e94\u7684\u6ce8\u518c\u8868\u8def\u5f84\u3001\u6dfb\u52a0\u6216\u4fee\u6539Python\u76f8\u5173\u7684\u6ce8\u518c\u8868\u9879\u3001\u786e\u4fddPython\u53ef\u6267\u884c\u6587\u4ef6\u7684\u8def\u5f84\u6b63\u786e\u3002<\/strong> \u4e0b\u9762\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u8fdb\u884c\u8fd9\u4e9b\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u6253\u5f00\u6ce8\u518c\u8868\u7f16\u8f91\u5668<\/h3>\n<\/p>\n<p><p>\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u6253\u5f00\u6ce8\u518c\u8868\u7f16\u8f91\u5668\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6309\u4e0b <code>Win + R<\/code> \u952e\uff0c\u6253\u5f00\u8fd0\u884c\u5bf9\u8bdd\u6846\u3002<\/li>\n<li>\u8f93\u5165 <code>regedit<\/code> \u5e76\u6309\u4e0b\u56de\u8f66\u952e\u3002<\/li>\n<li>\u5982\u679c\u51fa\u73b0\u7528\u6237\u8d26\u6237\u63a7\u5236\u63d0\u793a\uff0c\u9009\u62e9\u201c\u662f\u201d\u4ee5\u7ee7\u7eed\u3002<\/li>\n<\/ol>\n<p><h3>\u4e8c\u3001\u5b9a\u4f4d\u5230\u76f8\u5e94\u7684\u6ce8\u518c\u8868\u8def\u5f84<\/h3>\n<\/p>\n<p><p>Python\u7684\u6ce8\u518c\u8868\u9879\u901a\u5e38\u4f4d\u4e8e\u4ee5\u4e0b\u8def\u5f84\uff1a<\/p>\n<\/p>\n<ul>\n<li><strong>\u5bf9\u4e8e32\u4f4d\u7cfb\u7edf<\/strong>\uff1a<code>HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore<\/code><\/li>\n<li><strong>\u5bf9\u4e8e64\u4f4d\u7cfb\u7edf<\/strong>\uff1a<code>HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Python\\PythonCore<\/code><\/li>\n<\/ul>\n<p><p>\u5728\u6ce8\u518c\u8868\u7f16\u8f91\u5668\u4e2d\uff0c\u5bfc\u822a\u5230\u4e0a\u8ff0\u8def\u5f84\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u6dfb\u52a0\u6216\u4fee\u6539Python\u76f8\u5173\u7684\u6ce8\u518c\u8868\u9879<\/h3>\n<\/p>\n<p><p>\u5728\u76f8\u5e94\u7684\u6ce8\u518c\u8868\u8def\u5f84\u4e0b\uff0c\u4f60\u9700\u8981\u786e\u4fdd\u5b58\u5728\u4ee5\u4e0b\u9879\u548c\u5b50\u9879\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>\u6838\u5fc3\u8def\u5f84\uff08PythonCore\uff09<\/strong>\uff1a\n<ul>\n<li>\u5728 <code>PythonCore<\/code> \u4e0b\uff0c\u6839\u636e\u4f60\u5b89\u88c5\u7684Python\u7248\u672c\uff08\u4f8b\u59823.9\uff09\uff0c\u521b\u5efa\u4e00\u4e2a\u65b0\u9879\uff0c\u547d\u540d\u4e3a\u7248\u672c\u53f7\uff08\u5982 <code>3.9<\/code>\uff09\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u5b89\u88c5\u8def\u5f84\uff08InstallPath\uff09<\/strong>\uff1a\n<ul>\n<li>\u5728\u7248\u672c\u53f7\u9879\u4e0b\uff0c\u521b\u5efa\u4e00\u4e2a\u5b50\u9879\uff0c\u547d\u540d\u4e3a <code>InstallPath<\/code>\u3002<\/li>\n<li>\u5728 <code>InstallPath<\/code> \u9879\u4e0b\uff0c\u521b\u5efa\u4e00\u4e2a\u5b57\u7b26\u4e32\u503c\uff08\u9ed8\u8ba4\uff09\uff0c\u5e76\u5c06\u5176\u503c\u8bbe\u7f6e\u4e3aPython\u7684\u5b89\u88c5\u8def\u5f84\uff08\u4f8b\u5982 <code>C:\\Python39<\/code>\uff09\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>Python\u7684\u53ef\u6267\u884c\u6587\u4ef6\u8def\u5f84\uff08PythonPath\uff09<\/strong>\uff1a\n<ul>\n<li>\u5728\u7248\u672c\u53f7\u9879\u4e0b\uff0c\u521b\u5efa\u4e00\u4e2a\u5b50\u9879\uff0c\u547d\u540d\u4e3a <code>PythonPath<\/code>\u3002<\/li>\n<li>\u5728 <code>PythonPath<\/code> \u9879\u4e0b\uff0c\u521b\u5efa\u4e00\u4e2a\u5b57\u7b26\u4e32\u503c\uff08\u9ed8\u8ba4\uff09\uff0c\u5e76\u5c06\u5176\u503c\u8bbe\u7f6e\u4e3aPython\u7684\u5e93\u8def\u5f84\uff08\u4f8b\u5982 <code>C:\\Python39\\Lib<\/code>\uff09\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><h3>\u56db\u3001\u786e\u4fddPython\u53ef\u6267\u884c\u6587\u4ef6\u7684\u8def\u5f84\u6b63\u786e<\/h3>\n<\/p>\n<p><p>\u4e3a\u4e86\u786e\u4fddPython\u5728\u547d\u4ee4\u884c\u4e2d\u53ef\u4ee5\u88ab\u6b63\u786e\u8c03\u7528\uff0c\u4f60\u8fd8\u9700\u8981\u5c06Python\u7684\u5b89\u88c5\u8def\u5f84\u6dfb\u52a0\u5230\u7cfb\u7edf\u73af\u5883\u53d8\u91cf <code>PATH<\/code> \u4e2d\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u53f3\u952e\u70b9\u51fb\u201c\u6b64\u7535\u8111\u201d\u6216\u201c\u6211\u7684\u7535\u8111\u201d\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d\u3002<\/li>\n<li>\u9009\u62e9\u201c\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e\u201d\u3002<\/li>\n<li>\u5728\u201c\u7cfb\u7edf\u5c5e\u6027\u201d\u5bf9\u8bdd\u6846\u4e2d\uff0c\u9009\u62e9\u201c\u73af\u5883\u53d8\u91cf\u201d\u6309\u94ae\u3002<\/li>\n<li>\u5728\u201c\u7cfb\u7edf\u53d8\u91cf\u201d\u90e8\u5206\uff0c\u627e\u5230\u53d8\u91cf <code>Path<\/code> \u5e76\u9009\u62e9\u201c\u7f16\u8f91\u201d\u3002<\/li>\n<li>\u5728\u7f16\u8f91\u5bf9\u8bdd\u6846\u4e2d\uff0c\u6dfb\u52a0Python\u7684\u5b89\u88c5\u8def\u5f84\uff08\u4f8b\u5982 <code>C:\\Python39<\/code>\uff09\u5230\u53d8\u91cf\u503c\u4e2d\u3002<\/li>\n<\/ol>\n<p><h3>\u4e94\u3001\u9a8c\u8bc1\u8bbe\u7f6e<\/h3>\n<\/p>\n<p><p>\u5b8c\u6210\u4e0a\u8ff0\u6b65\u9aa4\u540e\uff0c\u4f60\u53ef\u4ee5\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08cmd\uff09\u5e76\u8f93\u5165 <code>python<\/code> \u6216 <code>python --version<\/code> \u6765\u9a8c\u8bc1Python\u662f\u5426\u5df2\u88ab\u6b63\u786e\u914d\u7f6e\u3002\u5982\u679c\u663e\u793aPython\u7684\u7248\u672c\u4fe1\u606f\uff0c\u5219\u8bf4\u660e\u914d\u7f6e\u6210\u529f\u3002<\/p>\n<\/p>\n<p><h3>\u8be6\u7ec6\u8bf4\u660e\u4e0e\u89c1\u89e3<\/h3>\n<\/p>\n<p><p><strong>\u786e\u4fdd\u8def\u5f84\u6b63\u786e<\/strong>\uff1a\u5728\u8bbe\u7f6e\u6ce8\u518c\u8868\u548c\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u65f6\uff0c\u786e\u4fdd\u8def\u5f84\u6b63\u786e\u662f\u81f3\u5173\u91cd\u8981\u7684\u3002\u5982\u679c\u8def\u5f84\u8bbe\u7f6e\u9519\u8bef\uff0c\u53ef\u80fd\u5bfc\u81f4Python\u65e0\u6cd5\u88ab\u6b63\u786e\u8c03\u7528\u6216\u52a0\u8f7d\u6a21\u5757\u65f6\u51fa\u73b0\u95ee\u9898\u3002<\/p>\n<\/p>\n<p><p><strong>\u5907\u4efd\u6ce8\u518c\u8868<\/strong>\uff1a\u4fee\u6539\u6ce8\u518c\u8868\u5b58\u5728\u4e00\u5b9a\u98ce\u9669\uff0c\u5efa\u8bae\u5728\u8fdb\u884c\u64cd\u4f5c\u524d\u5907\u4efd\u6ce8\u518c\u8868\u3002\u53ef\u4ee5\u901a\u8fc7\u6ce8\u518c\u8868\u7f16\u8f91\u5668\u4e2d\u7684\u201c\u6587\u4ef6\u201d\u83dc\u5355\u9009\u62e9\u201c\u5bfc\u51fa\u201d\u6765\u5907\u4efd\u5f53\u524d\u7684\u6ce8\u518c\u8868\u9879\u3002<\/p>\n<\/p>\n<p><p><strong>\u591a\u7248\u672c\u7ba1\u7406<\/strong>\uff1a\u5982\u679c\u7cfb\u7edf\u4e0a\u5b89\u88c5\u4e86\u591a\u4e2a\u7248\u672c\u7684Python\uff0c\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539\u6ce8\u518c\u8868\u6765\u7ba1\u7406\u9ed8\u8ba4\u7248\u672c\u3002\u786e\u4fdd\u5728 <code>PythonCore<\/code> \u4e0b\u4e3a\u6bcf\u4e2a\u7248\u672c\u521b\u5efa\u72ec\u7acb\u7684\u9879\uff0c\u5e76\u5728 <code>PATH<\/code> \u73af\u5883\u53d8\u91cf\u4e2d\u6839\u636e\u9700\u8981\u8c03\u6574\u7248\u672c\u8def\u5f84\u3002<\/p>\n<\/p>\n<p><p><strong>\u81ea\u52a8\u5316\u811a\u672c<\/strong>\uff1a\u5bf9\u4e8e\u9700\u8981\u9891\u7e41\u914d\u7f6ePython\u73af\u5883\u7684\u7528\u6237\uff0c\u53ef\u4ee5\u7f16\u5199\u6279\u5904\u7406\u811a\u672c\u6216\u4f7f\u7528PowerShell\u811a\u672c\u6765\u81ea\u52a8\u5316\u6ce8\u518c\u8868\u548c\u73af\u5883\u53d8\u91cf\u7684\u8bbe\u7f6e\u3002\u8fd9\u5c06\u63d0\u9ad8\u6548\u7387\u5e76\u51cf\u5c11\u624b\u52a8\u64cd\u4f5c\u7684\u9519\u8bef\u98ce\u9669\u3002<\/p>\n<\/p>\n<p><h3>\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u901a\u8fc7\u4e0a\u8ff0\u6b65\u9aa4\uff0c\u6211\u4eec\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u5982\u4f55\u8bbe\u7f6e\u6709\u5173Python\u7684\u6ce8\u518c\u8868\u3002\u8fd9\u4e9b\u914d\u7f6e\u6709\u52a9\u4e8e\u786e\u4fddPython\u5728Windows\u7cfb\u7edf\u4e0a\u7684\u6b63\u786e\u5b89\u88c5\u548c\u4f7f\u7528\u3002<strong>\u5173\u952e\u6b65\u9aa4\u5305\u62ec\u6253\u5f00\u6ce8\u518c\u8868\u7f16\u8f91\u5668\u3001\u5b9a\u4f4d\u5230\u6b63\u786e\u7684\u6ce8\u518c\u8868\u8def\u5f84\u3001\u6dfb\u52a0\u6216\u4fee\u6539Python\u76f8\u5173\u7684\u6ce8\u518c\u8868\u9879\u3001\u4ee5\u53ca\u786e\u4fddPython\u7684\u53ef\u6267\u884c\u6587\u4ef6\u8def\u5f84\u6b63\u786e<\/strong>\u3002\u6b64\u5916\uff0c\u5907\u4efd\u6ce8\u518c\u8868\u548c\u8def\u5f84\u8bbe\u7f6e\u7684\u6b63\u786e\u6027\u662f\u975e\u5e38\u91cd\u8981\u7684\uff0c\u4ee5\u907f\u514d\u51fa\u73b0\u95ee\u9898\u3002\u901a\u8fc7\u8fd9\u4e9b\u8bbe\u7f6e\uff0c\u53ef\u4ee5\u6709\u6548\u7ba1\u7406\u548c\u4f7f\u7528Python\u73af\u5883\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Windows\u4e0a\u627e\u5230Python\u7684\u6ce8\u518c\u8868\u8bbe\u7f6e\uff1f<\/strong><br \/>\u8981\u627e\u5230Python\u7684\u6ce8\u518c\u8868\u8bbe\u7f6e\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528Windows\u6ce8\u518c\u8868\u7f16\u8f91\u5668\u3002\u6253\u5f00\u8fd0\u884c\u7a97\u53e3\uff08Win + R\uff09\uff0c\u8f93\u5165\u201cregedit\u201d\u5e76\u6309Enter\u3002\u5728\u6ce8\u518c\u8868\u7f16\u8f91\u5668\u4e2d\uff0c\u5bfc\u822a\u5230\u4ee5\u4e0b\u8def\u5f84\uff1a<code>HKEY_LOCAL_MACHINE\\SOFTWARE\\Python<\/code> \u6216 <code>HKEY_CURRENT_USER\\SOFTWARE\\Python<\/code>\u3002\u5728\u8fd9\u4e9b\u4f4d\u7f6e\uff0c\u60a8\u53ef\u4ee5\u627e\u5230\u4e0e\u5df2\u5b89\u88c5Python\u7248\u672c\u76f8\u5173\u7684\u952e\u548c\u8bbe\u7f6e\u3002<\/p>\n<p><strong>\u5982\u4f55\u4fee\u6539Python\u7684\u6ce8\u518c\u8868\u503c\u4ee5\u89e3\u51b3\u73af\u5883\u53d8\u91cf\u95ee\u9898\uff1f<\/strong><br \/>\u5982\u679c\u60a8\u9047\u5230Python\u65e0\u6cd5\u8bc6\u522b\u7684\u73af\u5883\u53d8\u91cf\u95ee\u9898\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u6ce8\u518c\u8868\u7f16\u8f91\u5668\u8fdb\u884c\u4fee\u6539\u3002\u627e\u5230\u4e0ePython\u76f8\u5173\u7684\u952e\uff0c\u67e5\u770b\u201cInstallPath\u201d\u6216\u201cPath\u201d\u503c\uff0c\u5e76\u786e\u8ba4\u5b83\u4eec\u6307\u5411\u6b63\u786e\u7684Python\u5b89\u88c5\u76ee\u5f55\u3002\u786e\u4fdd\u8def\u5f84\u672b\u5c3e\u6709\u201c\\\u201d\u5b57\u7b26\uff0c\u4ee5\u4fbf\u7cfb\u7edf\u80fd\u591f\u6b63\u786e\u8bc6\u522b\u3002<\/p>\n<p><strong>\u66f4\u6539Python\u7684\u6ce8\u518c\u8868\u8bbe\u7f6e\u662f\u5426\u4f1a\u5f71\u54cd\u5df2\u5b89\u88c5\u7684Python\u5305\uff1f<\/strong><br \/>\u66f4\u6539Python\u7684\u6ce8\u518c\u8868\u8bbe\u7f6e\u53ef\u80fd\u4f1a\u5f71\u54cdPython\u7684\u8fd0\u884c\u65b9\u5f0f\uff0c\u4f46\u901a\u5e38\u4e0d\u4f1a\u76f4\u63a5\u5f71\u54cd\u5df2\u5b89\u88c5\u7684Python\u5305\u3002\u7136\u800c\uff0c\u82e5\u60a8\u4fee\u6539\u4e86\u201cPath\u201d\u6216\u201cVersion\u201d\u503c\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u67d0\u4e9b\u5305\u65e0\u6cd5\u6b63\u5e38\u5de5\u4f5c\u6216\u51fa\u73b0\u517c\u5bb9\u6027\u95ee\u9898\u3002\u56e0\u6b64\uff0c\u4fee\u6539\u524d\u8bf7\u52a1\u5fc5\u5907\u4efd\u6ce8\u518c\u8868\uff0c\u5e76\u8c28\u614e\u64cd\u4f5c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8bbe\u7f6e\u6709\u5173Python\u7684\u6ce8\u518c\u8868\uff0c\u9996\u5148\u9700\u8981\u786e\u4fdd\u4f60\u5df2\u7ecf\u5728\u7cfb\u7edf\u4e0a\u5b89\u88c5\u4e86Python\u3002\u7136\u540e\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7Windows\u6ce8\u518c [&hellip;]","protected":false},"author":3,"featured_media":1038880,"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\/1038865"}],"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=1038865"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1038865\/revisions"}],"predecessor-version":[{"id":1038881,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1038865\/revisions\/1038881"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1038880"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1038865"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1038865"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1038865"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}