{"id":999020,"date":"2024-12-27T09:37:53","date_gmt":"2024-12-27T01:37:53","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/999020.html"},"modified":"2024-12-27T09:37:55","modified_gmt":"2024-12-27T01:37:55","slug":"%e5%a6%82%e4%bd%95%e6%9f%a5%e7%9c%8b%e7%94%b5%e8%84%91%e5%ae%89%e8%a3%85python","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/999020.html","title":{"rendered":"\u5982\u4f55\u67e5\u770b\u7535\u8111\u5b89\u88c5Python"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25074218\/a5edb8fd-4996-4c36-83b9-53c214551dc6.webp\" alt=\"\u5982\u4f55\u67e5\u770b\u7535\u8111\u5b89\u88c5Python\" \/><\/p>\n<p><p> <strong>\u8981\u67e5\u770b\u7535\u8111\u662f\u5426\u5b89\u88c5\u4e86Python\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177\u68c0\u67e5\u3001\u67e5\u770bPython\u5b89\u88c5\u8def\u5f84\u3001\u4f7f\u7528Python\u89e3\u91ca\u5668\u68c0\u67e5\u7248\u672c\u3001\u68c0\u67e5\u73af\u5883\u53d8\u91cf\u4e2d\u662f\u5426\u5b58\u5728Python\u8def\u5f84\u3002<\/strong> \u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u5feb\u901f\u786e\u8ba4\u5e76\u83b7\u53d6\u66f4\u591a\u4fe1\u606f\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177\u68c0\u67e5<\/p>\n<\/p>\n<p><p>\u5728Windows\u3001macOS\u6216Linux\u7cfb\u7edf\u4e2d\uff0c\u547d\u4ee4\u884c\u5de5\u5177\u662f\u6700\u76f4\u63a5\u7684\u65b9\u6cd5\u4e4b\u4e00\u3002\u901a\u8fc7\u547d\u4ee4\u884c\u5de5\u5177\u53ef\u4ee5\u5feb\u901f\u67e5\u770bPython\u662f\u5426\u5df2\u5b89\u88c5\u53ca\u5176\u7248\u672c\u4fe1\u606f\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>Windows\u7cfb\u7edf<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08\u6309\u4e0b<code>Win + R<\/code>\uff0c\u8f93\u5165<code>cmd<\/code>\uff0c\u7136\u540e\u6309\u4e0bEnter\u952e\uff09\u3002<\/li>\n<li>\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u7a97\u53e3\u4e2d\u8f93\u5165<code>python --version<\/code>\u6216<code>python -V<\/code>\uff0c\u6309\u4e0bEnter\u952e\u3002<\/li>\n<li>\u5982\u679cPython\u5df2\u5b89\u88c5\uff0c\u7cfb\u7edf\u4f1a\u663e\u793a\u5b89\u88c5\u7684Python\u7248\u672c\u53f7\u3002\u5982\u679c\u6ca1\u6709\u5b89\u88c5\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u627e\u4e0d\u5230\u8be5\u547d\u4ee4\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>macOS\u548cLinux\u7cfb\u7edf<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u6253\u5f00\u7ec8\u7aef\u5e94\u7528\u7a0b\u5e8f\u3002<\/li>\n<li>\u8f93\u5165<code>python3 --version<\/code>\u6216<code>python3 -V<\/code>\uff0c\u7136\u540e\u6309\u4e0bEnter\u952e\u3002<\/li>\n<li>\u540c\u6837\uff0c\u7cfb\u7edf\u4f1a\u663e\u793a\u5b89\u88c5\u7684Python\u7248\u672c\u53f7\uff0c\u6216\u8005\u63d0\u793a\u6ca1\u6709\u5b89\u88c5\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><p>\u4e8c\u3001\u67e5\u770bPython\u5b89\u88c5\u8def\u5f84<\/p>\n<\/p>\n<p><p>Python\u7684\u5b89\u88c5\u8def\u5f84\u53ef\u4ee5\u5e2e\u52a9\u786e\u8ba4Python\u662f\u5426\u5df2\u6b63\u786e\u5b89\u88c5\uff0c\u5e76\u786e\u4fdd\u4f7f\u7528\u7684\u662f\u6b63\u786e\u7684\u7248\u672c\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>Windows\u7cfb\u7edf<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8f93\u5165<code>where python<\/code>\u3002<\/li>\n<li>\u8be5\u547d\u4ee4\u5c06\u5217\u51faPython\u53ef\u6267\u884c\u6587\u4ef6\u7684\u8def\u5f84\u3002\u5982\u679c\u5b89\u88c5\u4e86\u591a\u4e2a\u7248\u672c\uff0c\u5b83\u5c06\u663e\u793a\u591a\u4e2a\u8def\u5f84\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>macOS\u548cLinux\u7cfb\u7edf<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165<code>which python3<\/code>\u3002<\/li>\n<li>\u8fd9\u5c06\u663e\u793aPython\u53ef\u6267\u884c\u6587\u4ef6\u7684\u8def\u5f84\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><p><strong>\u8be6\u7ec6\u63cf\u8ff0\u67e5\u770bPython\u5b89\u88c5\u8def\u5f84\u7684\u610f\u4e49\uff1a<\/strong><\/p>\n<\/p>\n<p><p>\u67e5\u770bPython\u5b89\u88c5\u8def\u5f84\u975e\u5e38\u91cd\u8981\uff0c\u5c24\u5176\u662f\u5728\u591a\u7248\u672c\u5171\u5b58\u7684\u73af\u5883\u4e2d\u3002\u5f88\u591a\u5f00\u53d1\u8005\u5728\u9879\u76ee\u4e2d\u53ef\u80fd\u9700\u8981\u4f7f\u7528\u7279\u5b9a\u7248\u672c\u7684Python\uff0c\u56e0\u6b64\u77e5\u9053\u6bcf\u4e2a\u7248\u672c\u7684\u786e\u5207\u8def\u5f84\u53ef\u4ee5\u5e2e\u52a9\u5f00\u53d1\u8005\u5728\u9879\u76ee\u914d\u7f6e\u4e2d\u6307\u5b9a\u6b63\u786e\u7684Python\u7248\u672c\u3002\u540c\u65f6\uff0c\u786e\u8ba4\u8def\u5f84\u53ef\u4ee5\u786e\u4fdd\u7cfb\u7edf\u6ca1\u6709\u4f7f\u7528\u9519\u8bef\u7684\u7248\u672c\uff0c\u907f\u514d\u53ef\u80fd\u7684\u517c\u5bb9\u6027\u95ee\u9898\u3002<\/p>\n<\/p>\n<p><p>\u4e09\u3001\u4f7f\u7528Python\u89e3\u91ca\u5668\u68c0\u67e5\u7248\u672c<\/p>\n<\/p>\n<p><p>\u9664\u4e86\u901a\u8fc7\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u76f4\u63a5\u4f7f\u7528Python\u89e3\u91ca\u5668\u4e5f\u662f\u4e00\u79cd\u7b80\u5355\u7684\u65b9\u6cd5\u6765\u786e\u8ba4\u7248\u672c\u3002<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u6216\u7ec8\u7aef\u3002<\/li>\n<li>\u8f93\u5165<code>python<\/code>\u6216<code>python3<\/code>\uff0c\u7136\u540e\u6309\u4e0bEnter\u952e\u3002<\/li>\n<li>\u5982\u679cPython\u5df2\u5b89\u88c5\uff0c\u5c06\u770b\u5230Python\u89e3\u91ca\u5668\u542f\u52a8\uff0c\u5e76\u663e\u793a\u7248\u672c\u4fe1\u606f\u3002<\/li>\n<\/ol>\n<p><p>\u56db\u3001\u68c0\u67e5\u73af\u5883\u53d8\u91cf\u4e2d\u662f\u5426\u5b58\u5728Python\u8def\u5f84<\/p>\n<\/p>\n<p><p>\u5728Windows\u548cUnix\u7cfb\u7edf\u4e2d\uff0c\u73af\u5883\u53d8\u91cf\u4e2d\u5305\u542b\u7684Python\u8def\u5f84\u53ef\u4ee5\u5e2e\u52a9\u786e\u8ba4Python\u662f\u5426\u5df2\u5b89\u88c5\uff0c\u5e76\u4e14\u786e\u4fdd\u7cfb\u7edf\u53ef\u4ee5\u6b63\u786e\u8c03\u7528Python\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>Windows\u7cfb\u7edf<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u53f3\u952e\u70b9\u51fb\u201c\u6b64\u7535\u8111\u201d\u6216\u201c\u8ba1\u7b97\u673a\u201d\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d\u3002<\/li>\n<li>\u70b9\u51fb\u201c\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e\u201d\uff0c\u7136\u540e\u70b9\u51fb\u201c\u73af\u5883\u53d8\u91cf\u201d\u3002<\/li>\n<li>\u5728\u201c\u7cfb\u7edf\u53d8\u91cf\u201d\u4e2d\u67e5\u627e\u201cPath\u201d\u53d8\u91cf\uff0c\u67e5\u770b\u662f\u5426\u5305\u542bPython\u8def\u5f84\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>macOS\u548cLinux\u7cfb\u7edf<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u6253\u5f00\u7ec8\u7aef\uff0c\u8f93\u5165<code>echo $PATH<\/code>\u3002<\/li>\n<li>\u68c0\u67e5\u8f93\u51fa\u4fe1\u606f\u4e2d\u662f\u5426\u5305\u542bPython\u7684\u5b89\u88c5\u8def\u5f84\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><p>\u4e94\u3001\u603b\u7ed3\u4e0e\u5efa\u8bae<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u786e\u4fdd\u7cfb\u7edf\u4e2d\u5b89\u88c5\u7684\u662f\u6700\u65b0\u7248\u672c\u7684Python<\/strong>\uff1a\u4e3a\u4e86\u5229\u7528Python\u7684\u6700\u65b0\u529f\u80fd\u548c\u5b89\u5168\u8865\u4e01\uff0c\u5efa\u8bae\u5b9a\u671f\u66f4\u65b0Python\u7248\u672c\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8003\u8651\u4f7f\u7528\u865a\u62df\u73af\u5883<\/strong>\uff1a\u5728\u5f00\u53d1\u8fc7\u7a0b\u4e2d\uff0c\u4f7f\u7528\u865a\u62df\u73af\u5883\u53ef\u4ee5\u6709\u6548\u9694\u79bb\u9879\u76ee\u7684\u4f9d\u8d56\u5173\u7cfb\uff0c\u907f\u514d\u7248\u672c\u51b2\u7a81\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5Python\u65f6\u9009\u62e9\u6dfb\u52a0\u5230\u73af\u5883\u53d8\u91cf<\/strong>\uff1a\u5728Windows\u7cfb\u7edf\u4e2d\u5b89\u88c5Python\u65f6\uff0c\u786e\u4fdd\u9009\u62e9\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u4ee5\u4fbf\u4e8e\u547d\u4ee4\u884c\u5de5\u5177\u80fd\u591f\u8bc6\u522bPython\u547d\u4ee4\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u4e0a\u8ff0\u65b9\u6cd5\uff0c\u60a8\u53ef\u4ee5\u8f7b\u677e\u786e\u8ba4\u7535\u8111\u662f\u5426\u5df2\u5b89\u88c5Python\uff0c\u5e76\u83b7\u53d6\u76f8\u5173\u4fe1\u606f\u4ee5\u652f\u6301\u5f00\u53d1\u5de5\u4f5c\u3002\u786e\u4fddPython\u5b89\u88c5\u548c\u914d\u7f6e\u6b63\u786e\uff0c\u53ef\u4ee5\u5e2e\u52a9\u60a8\u66f4\u9ad8\u6548\u5730\u8fdb\u884c\u7f16\u7a0b\u548c\u89e3\u51b3\u95ee\u9898\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u786e\u8ba4\u6211\u7684\u7535\u8111\u4e0a\u5b89\u88c5\u4e86\u54ea\u4e2a\u7248\u672c\u7684Python\uff1f<\/strong><br \/>\u8981\u67e5\u770b\u60a8\u7535\u8111\u4e0a\u5b89\u88c5\u7684Python\u7248\u672c\uff0c\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u6216\u7ec8\u7aef\u4e2d\u8f93\u5165<code>python --version<\/code>\u6216<code>python3 --version<\/code>\u3002\u8be5\u547d\u4ee4\u5c06\u8fd4\u56de\u60a8\u5f53\u524d\u5b89\u88c5\u7684Python\u7248\u672c\u53f7\u3002\u5982\u679c\u5b89\u88c5\u4e86\u591a\u4e2a\u7248\u672c\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u4f7f\u7528<code>python3<\/code>\u6765\u83b7\u53d6\u5177\u4f53\u7684\u7248\u672c\u4fe1\u606f\u3002<\/p>\n<p><strong>\u6211\u53ef\u4ee5\u901a\u8fc7\u54ea\u4e9b\u65b9\u5f0f\u5b89\u88c5Python\uff1f<\/strong><br \/>\u5b89\u88c5Python\u7684\u65b9\u5f0f\u6709\u591a\u79cd\u9009\u62e9\uff0c\u5305\u62ec\u76f4\u63a5\u4ecePython\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u9002\u5408\u60a8\u64cd\u4f5c\u7cfb\u7edf\u7684\u5b89\u88c5\u5305\uff0c\u4f7f\u7528\u5305\u7ba1\u7406\u5de5\u5177\uff08\u5982Windows\u7684Chocolatey\u6216Linux\u7684apt\uff09\u8fdb\u884c\u5b89\u88c5\uff0c\u6216\u8005\u4f7f\u7528Anaconda\u7b49\u96c6\u6210\u73af\u5883\u3002\u9009\u62e9\u9002\u5408\u60a8\u9700\u6c42\u7684\u65b9\u6cd5\uff0c\u53ef\u4ee5\u66f4\u65b9\u4fbf\u5730\u8fdb\u884c\u5f00\u53d1\u548c\u7ba1\u7406\u3002<\/p>\n<p><strong>\u5982\u679c\u6211\u5728\u7535\u8111\u4e0a\u627e\u4e0d\u5230Python\uff0c\u6211\u8be5\u5982\u4f55\u5904\u7406\uff1f<\/strong><br \/>\u5982\u679c\u60a8\u5728\u7535\u8111\u4e0a\u627e\u4e0d\u5230Python\uff0c\u9996\u5148\u786e\u8ba4\u662f\u5426\u5df2\u7ecf\u5b89\u88c5\u3002\u53ef\u4ee5\u901a\u8fc7\u641c\u7d22\u201cPython\u201d\u6765\u68c0\u67e5\u3002\u5982\u679c\u672a\u5b89\u88c5\uff0c\u60a8\u53ef\u4ee5\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u6700\u65b0\u7248\u672c\uff0c\u6309\u7167\u6307\u793a\u5b8c\u6210\u5b89\u88c5\u3002\u5982\u679c\u60a8\u4e0d\u786e\u5b9a\u5982\u4f55\u64cd\u4f5c\uff0c\u53ef\u4ee5\u53c2\u8003\u5728\u7ebf\u6559\u7a0b\u6216\u89c6\u9891\uff0c\u4ee5\u4fbf\u66f4\u597d\u5730\u7406\u89e3\u5b89\u88c5\u6b65\u9aa4\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u67e5\u770b\u7535\u8111\u662f\u5426\u5b89\u88c5\u4e86Python\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177\u68c0\u67e5\u3001\u67e5\u770bPython\u5b89\u88c5\u8def\u5f84\u3001\u4f7f\u7528Python\u89e3\u91ca\u5668\u68c0\u67e5 [&hellip;]","protected":false},"author":3,"featured_media":999029,"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\/999020"}],"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=999020"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/999020\/revisions"}],"predecessor-version":[{"id":999030,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/999020\/revisions\/999030"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/999029"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=999020"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=999020"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=999020"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}