{"id":1097649,"date":"2025-01-08T15:13:53","date_gmt":"2025-01-08T07:13:53","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1097649.html"},"modified":"2025-01-08T15:13:55","modified_gmt":"2025-01-08T07:13:55","slug":"%e5%a6%82%e4%bd%95%e5%b0%86python%e5%ae%89%e8%a3%85%e5%88%b0%e5%88%ab%e7%9a%84%e7%9b%98%e4%b8%8a-2","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1097649.html","title":{"rendered":"\u5982\u4f55\u5c06Python\u5b89\u88c5\u5230\u522b\u7684\u76d8\u4e0a"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24212334\/1057f428-f7cb-40f6-81a2-76fba9f5fe59.webp\" alt=\"\u5982\u4f55\u5c06Python\u5b89\u88c5\u5230\u522b\u7684\u76d8\u4e0a\" \/><\/p>\n<p><p> <strong>\u5982\u4f55\u5c06Python\u5b89\u88c5\u5230\u522b\u7684\u76d8\u4e0a<\/strong><\/p>\n<\/p>\n<p><p>\u8981\u5c06Python\u5b89\u88c5\u5230\u522b\u7684\u76d8\u4e0a\uff0c\u53ef\u4ee5\u901a\u8fc7<strong>\u81ea\u5b9a\u4e49\u5b89\u88c5\u8def\u5f84\u3001\u4f7f\u7528Python\u5b98\u7f51\u5b89\u88c5\u5305\u3001\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<\/strong>\u7b49\u6b65\u9aa4\u6765\u5b9e\u73b0\u3002\u9996\u5148\uff0c\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u9009\u62e9\u81ea\u5b9a\u4e49\u5b89\u88c5\u8def\u5f84\uff0c\u5c06\u5b89\u88c5\u76ee\u5f55\u6539\u4e3a\u76ee\u6807\u76d8\u7b26\u4e0a\u7684\u8def\u5f84\u3002\u63a5\u4e0b\u6765\uff0c\u786e\u4fdd\u4e0b\u8f7d\u7684\u5b89\u88c5\u5305\u662f\u4ecePython\u5b98\u7f51\u83b7\u53d6\u7684\uff0c\u4ee5\u907f\u514d\u6f5c\u5728\u7684\u5b89\u5168\u95ee\u9898\u3002\u6700\u540e\uff0c\u5b89\u88c5\u5b8c\u6210\u540e\u9700\u8981\u624b\u52a8\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\uff0c\u4ee5\u4fbf\u5728\u547d\u4ee4\u884c\u4e2d\u5168\u5c40\u4f7f\u7528Python\u3002\u4ee5\u4e0b\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u8fd9\u4e9b\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4e0b\u8f7dPython\u5b89\u88c5\u5305<\/h3>\n<\/p>\n<p><p>\u4e3a\u4e86\u786e\u4fdd\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u4e0d\u4f1a\u51fa\u73b0\u95ee\u9898\uff0c\u5efa\u8bae\u4ecePython\u5b98\u7f51\uff08<a href=\"https:\/\/www.python.org\/downloads\/%EF%BC%89%E4%B8%8B%E8%BD%BD%E6%9C%80%E6%96%B0%E7%89%88%E6%9C%AC%E7%9A%84%E5%AE%89%E8%A3%85%E5%8C%85%E3%80%82%E4%B8%8B%E8%BD%BD%E5%AE%8C%E6%88%90%E5%90%8E%EF%BC%8C%E5%8F%8C%E5%87%BB%E5%AE%89%E8%A3%85%E5%8C%85%E5%90%AF%E5%8A%A8%E5%AE%89%E8%A3%85%E7%A8%8B%E5%BA%8F%E3%80%82\">https:\/\/www.python.org\/downloads\/\uff09\u4e0b\u8f7d\u6700\u65b0\u7248\u672c\u7684\u5b89\u88c5\u5305\u3002\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u53cc\u51fb\u5b89\u88c5\u5305\u542f\u52a8\u5b89\u88c5\u7a0b\u5e8f\u3002<\/a><\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u9009\u62e9\u81ea\u5b9a\u4e49\u5b89\u88c5\u8def\u5f84<\/h3>\n<\/p>\n<ol>\n<li>\u542f\u52a8\u5b89\u88c5\u7a0b\u5e8f\u540e\uff0c\u9996\u5148\u52fe\u9009\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u8fd9\u4e00\u6b65\u975e\u5e38\u91cd\u8981\uff0c\u53ef\u4ee5\u786e\u4fddPython\u7684\u8def\u5f84\u80fd\u591f\u88ab\u7cfb\u7edf\u8bc6\u522b\u3002<\/li>\n<li>\u70b9\u51fb\u201cCustomize installation\u201d\u6309\u94ae\uff0c\u8fdb\u5165\u81ea\u5b9a\u4e49\u5b89\u88c5\u754c\u9762\u3002\u5728\u8fd9\u4e2a\u754c\u9762\u4e2d\uff0c\u53ef\u4ee5\u9009\u62e9\u9700\u8981\u5b89\u88c5\u7684\u7ec4\u4ef6\uff0c\u901a\u5e38\u9ed8\u8ba4\u9009\u9879\u5373\u53ef\u3002<\/li>\n<li>\u70b9\u51fb\u201cNext\u201d\u7ee7\u7eed\uff0c\u8fdb\u5165\u201cAdvanced Options\u201d\u754c\u9762\u3002\u5728\u8fd9\u4e2a\u754c\u9762\u4e2d\uff0c\u53ef\u4ee5\u770b\u5230\u201cInstall for all users\u201d\u548c\u201cCustomize installation location\u201d\u4e24\u4e2a\u9009\u9879\u3002\u52fe\u9009\u201cCustomize installation location\u201d\uff0c\u7136\u540e\u5728\u4e0b\u65b9\u7684\u8f93\u5165\u6846\u4e2d\u8f93\u5165\u76ee\u6807\u76d8\u7b26\u7684\u5b89\u88c5\u8def\u5f84\uff0c\u4f8b\u5982\u201cD:\\Python\u201d\u3002<\/li>\n<\/ol>\n<p><h3>\u4e09\u3001\u5b8c\u6210\u5b89\u88c5<\/h3>\n<\/p>\n<p><p>\u786e\u8ba4\u8def\u5f84\u65e0\u8bef\u540e\uff0c\u70b9\u51fb\u201cInstall\u201d\u6309\u94ae\u5f00\u59cb\u5b89\u88c5\u3002\u5b89\u88c5\u8fc7\u7a0b\u53ef\u80fd\u9700\u8981\u51e0\u5206\u949f\u7684\u65f6\u95f4\uff0c\u53d6\u51b3\u4e8e\u7535\u8111\u7684\u6027\u80fd\u548c\u5b89\u88c5\u5305\u7684\u5927\u5c0f\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u5b89\u88c5\u7a0b\u5e8f\u4f1a\u63d0\u793a\u6210\u529f\u4fe1\u606f\uff0c\u70b9\u51fb\u201cClose\u201d\u6309\u94ae\u5173\u95ed\u5b89\u88c5\u7a0b\u5e8f\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<\/h3>\n<\/p>\n<p><p>\u5c3d\u7ba1\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u52fe\u9009\u4e86\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u4f46\u4e3a\u4e86\u786e\u4fdd\u5728\u547d\u4ee4\u884c\u4e2d\u80fd\u591f\u5168\u5c40\u4f7f\u7528Python\uff0c\u5efa\u8bae\u624b\u52a8\u68c0\u67e5\u548c\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3002<\/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>\u5728\u6253\u5f00\u7684\u5c5e\u6027\u7a97\u53e3\u4e2d\uff0c\u70b9\u51fb\u201c\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e\u201d\u3002<\/li>\n<li>\u5728\u201c\u7cfb\u7edf\u5c5e\u6027\u201d\u7a97\u53e3\u4e2d\uff0c\u70b9\u51fb\u201c\u73af\u5883\u53d8\u91cf\u201d\u6309\u94ae\u3002<\/li>\n<li>\u5728\u201c\u73af\u5883\u53d8\u91cf\u201d\u7a97\u53e3\u4e2d\uff0c\u627e\u5230\u7cfb\u7edf\u53d8\u91cf\u4e2d\u7684\u201cPath\u201d\u53d8\u91cf\uff0c\u9009\u4e2d\u5e76\u70b9\u51fb\u201c\u7f16\u8f91\u201d\u6309\u94ae\u3002<\/li>\n<li>\u5728\u201c\u7f16\u8f91\u73af\u5883\u53d8\u91cf\u201d\u7a97\u53e3\u4e2d\uff0c\u70b9\u51fb\u201c\u65b0\u5efa\u201d\u6309\u94ae\uff0c\u7136\u540e\u8f93\u5165Python\u7684\u5b89\u88c5\u8def\u5f84\uff0c\u4f8b\u5982\u201cD:\\Python\\Scripts\\\u201d \u548c \u201cD:\\Python\\\u201d\u3002<\/li>\n<\/ol>\n<p><h3>\u4e94\u3001\u9a8c\u8bc1\u5b89\u88c5<\/h3>\n<\/p>\n<p><p>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08cmd\uff09\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u9a8c\u8bc1Python\u662f\u5426\u5b89\u88c5\u6210\u529f\u5e76\u8bbe\u7f6e\u597d\u4e86\u73af\u5883\u53d8\u91cf\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u5b89\u88c5\u6210\u529f\uff0c\u5c06\u4f1a\u663e\u793aPython\u7684\u7248\u672c\u53f7\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679cpip\u5b89\u88c5\u6210\u529f\uff0c\u5c06\u4f1a\u663e\u793apip\u7684\u7248\u672c\u53f7\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u5b89\u88c5\u5e38\u89c1\u95ee\u9898\u53ca\u89e3\u51b3\u65b9\u6cd5<\/h3>\n<\/p>\n<p><h4>1\u3001\u8def\u5f84\u8f93\u5165\u9519\u8bef<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u8f93\u5165\u7684\u8def\u5f84\u6709\u8bef\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u5b89\u88c5\u5931\u8d25\u6216Python\u65e0\u6cd5\u8fd0\u884c\u3002\u56e0\u6b64\uff0c\u5728\u8f93\u5165\u81ea\u5b9a\u4e49\u5b89\u88c5\u8def\u5f84\u65f6\uff0c\u4e00\u5b9a\u8981\u4ed4\u7ec6\u68c0\u67e5\u8def\u5f84\u662f\u5426\u6b63\u786e\u3002<\/p>\n<\/p>\n<p><h4>2\u3001\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u9519\u8bef<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u5728\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u65f6\u8f93\u5165\u7684\u8def\u5f84\u6709\u8bef\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u547d\u4ee4\u884c\u65e0\u6cd5\u8bc6\u522bPython\u547d\u4ee4\u3002\u56e0\u6b64\uff0c\u5728\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u65f6\uff0c\u4e00\u5b9a\u8981\u786e\u4fdd\u8f93\u5165\u7684\u8def\u5f84\u4e0e\u5b9e\u9645\u5b89\u88c5\u8def\u5f84\u4e00\u81f4\u3002<\/p>\n<\/p>\n<p><h4>3\u3001\u6743\u9650\u95ee\u9898<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u9047\u5230\u6743\u9650\u95ee\u9898\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\uff0c\u6216\u8005\u9009\u62e9\u201cInstall for all users\u201d\u9009\u9879\u3002<\/p>\n<\/p>\n<p><h3>\u4e03\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u901a\u8fc7\u81ea\u5b9a\u4e49\u5b89\u88c5\u8def\u5f84\u3001\u4f7f\u7528Python\u5b98\u7f51\u5b89\u88c5\u5305\u3001\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u7b49\u6b65\u9aa4\uff0c\u53ef\u4ee5\u5c06Python\u5b89\u88c5\u5230\u522b\u7684\u76d8\u4e0a\uff0c\u5e76\u786e\u4fdd\u5728\u547d\u4ee4\u884c\u4e2d\u5168\u5c40\u4f7f\u7528Python\u3002\u8fd9\u6837\u4e0d\u4ec5\u53ef\u4ee5\u8282\u7701\u7cfb\u7edf\u76d8\u7684\u7a7a\u95f4\uff0c\u8fd8\u53ef\u4ee5\u66f4\u65b9\u4fbf\u5730\u7ba1\u7406Python\u7684\u5b89\u88c5\u548c\u4f7f\u7528\u3002\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u52a1\u5fc5\u4ed4\u7ec6\u68c0\u67e5\u6bcf\u4e00\u6b65\u7684\u64cd\u4f5c\uff0c\u786e\u4fdd\u8def\u5f84\u548c\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u6b63\u786e\uff0c\u4ee5\u907f\u514d\u51fa\u73b0\u4e0d\u5fc5\u8981\u7684\u95ee\u9898\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728\u4e0d\u540c\u7684\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u5b89\u88c5Python\u5230\u975e\u9ed8\u8ba4\u76d8\u7b26\uff1f<\/strong><br \/>\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u5b89\u88c5Python\u65f6\u53ef\u4ee5\u9009\u62e9\u5b89\u88c5\u8def\u5f84\u3002\u5728\u5b89\u88c5\u5411\u5bfc\u4e2d\uff0c\u9009\u62e9\u201cCustomize installation\u201d\uff0c\u7136\u540e\u5728\u201cLocation\u201d\u5b57\u6bb5\u4e2d\u8f93\u5165\u4f60\u5e0c\u671b\u5b89\u88c5Python\u7684\u76d8\u7b26\u548c\u6587\u4ef6\u5939\u8def\u5f84\u3002\u4f8b\u5982\uff0cD:\\Python\u3002\u5bf9\u4e8eLinux\u6216MacOS\u7528\u6237\uff0c\u53ef\u4ee5\u4f7f\u7528\u5305\u7ba1\u7406\u5de5\u5177\uff08\u5982apt\u6216brew\uff09\u5b89\u88c5Python\uff0c\u7136\u540e\u901a\u8fc7\u4fee\u6539\u73af\u5883\u53d8\u91cf\u6765\u6307\u5b9aPython\u7684\u8def\u5f84\u3002<\/p>\n<p><strong>\u5728\u5b89\u88c5Python\u65f6\u9700\u8981\u6ce8\u610f\u54ea\u4e9b\u4f9d\u8d56\u9879\u6216\u8bbe\u7f6e\uff1f<\/strong><br \/>\u5728\u5b89\u88c5Python\u4e4b\u524d\uff0c\u786e\u4fdd\u7cfb\u7edf\u6ee1\u8db3\u6240\u9700\u7684\u4f9d\u8d56\u9879\uff0c\u4f8b\u5982\u786e\u4fdd\u64cd\u4f5c\u7cfb\u7edf\u662f\u6700\u65b0\u7684\u3002\u5728Windows\u4e0a\uff0c\u5b89\u88c5\u65f6\u53ef\u4ee5\u9009\u62e9\u6dfb\u52a0Python\u5230\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u4e2d\uff0c\u8fd9\u6837\u5728\u547d\u4ee4\u884c\u4e2d\u5c31\u53ef\u4ee5\u76f4\u63a5\u8c03\u7528Python\u3002\u6b64\u5916\uff0c\u5b89\u88c5pip\uff08Python\u5305\u7ba1\u7406\u5de5\u5177\uff09\u901a\u5e38\u4e5f\u662f\u63a8\u8350\u7684\u9009\u62e9\uff0c\u8fd9\u6837\u53ef\u4ee5\u65b9\u4fbf\u540e\u7eed\u5b89\u88c5\u989d\u5916\u7684\u5e93\u548c\u5de5\u5177\u3002<\/p>\n<p><strong>\u5982\u4f55\u786e\u8ba4Python\u662f\u5426\u6210\u529f\u5b89\u88c5\u5728\u6307\u5b9a\u7684\u76d8\u7b26\u4e0a\uff1f<\/strong><br \/>\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u9a8c\u8bc1Python\u7684\u5b89\u88c5\u3002\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08Windows\uff09\u6216\u7ec8\u7aef\uff08Linux\/MacOS\uff09\uff0c\u8f93\u5165<code>python --version<\/code>\u6216\u8005<code>python3 --version<\/code>\uff0c\u5982\u679c\u8fd4\u56de\u4e86Python\u7684\u7248\u672c\u53f7\uff0c\u8bf4\u660e\u5b89\u88c5\u6210\u529f\u3002\u6b64\u5916\uff0c\u53ef\u4ee5\u68c0\u67e5\u6307\u5b9a\u7684\u5b89\u88c5\u8def\u5f84\uff0c\u786e\u8ba4Python\u7684\u53ef\u6267\u884c\u6587\u4ef6\u548c\u76f8\u5173\u5e93\u662f\u5426\u5b58\u5728\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5982\u4f55\u5c06Python\u5b89\u88c5\u5230\u522b\u7684\u76d8\u4e0a \u8981\u5c06Python\u5b89\u88c5\u5230\u522b\u7684\u76d8\u4e0a\uff0c\u53ef\u4ee5\u901a\u8fc7\u81ea\u5b9a\u4e49\u5b89\u88c5\u8def\u5f84\u3001\u4f7f\u7528Python\u5b98\u7f51 [&hellip;]","protected":false},"author":3,"featured_media":1097656,"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\/1097649"}],"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=1097649"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1097649\/revisions"}],"predecessor-version":[{"id":1097659,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1097649\/revisions\/1097659"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1097656"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1097649"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1097649"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1097649"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}