{"id":1068373,"date":"2024-12-31T16:42:53","date_gmt":"2024-12-31T08:42:53","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1068373.html"},"modified":"2024-12-31T16:42:55","modified_gmt":"2024-12-31T08:42:55","slug":"%e5%a6%82%e4%bd%95%e7%9f%a5%e9%81%93%e7%94%b5%e8%84%91%e4%b8%ad%e6%9c%89%e6%b2%a1%e6%9c%89%e5%ae%89%e8%a3%85python","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1068373.html","title":{"rendered":"\u5982\u4f55\u77e5\u9053\u7535\u8111\u4e2d\u6709\u6ca1\u6709\u5b89\u88c5python"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-docs.pingcode.com\/wp-content\/uploads\/2024\/12\/d2eeab3c-4fad-47e2-a5f2-38d95d8a88f6.webp?x-oss-process=image\/auto-orient,1\/format,webp\" alt=\"\u5982\u4f55\u77e5\u9053\u7535\u8111\u4e2d\u6709\u6ca1\u6709\u5b89\u88c5python\" \/><\/p>\n<p><p> <strong>\u8981\u77e5\u9053\u7535\u8111\u4e2d\u6709\u6ca1\u6709\u5b89\u88c5Python\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u51e0\u79cd\u65b9\u6cd5\uff1a\u68c0\u67e5\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u3001\u4f7f\u7528\u547d\u4ee4\u884c\u3001\u67e5\u770bPython\u6587\u4ef6\u5939\u3001\u4f7f\u7528\u7279\u5b9a\u8f6f\u4ef6\u8fdb\u884c\u68c0\u6d4b\u3002<\/strong> \u901a\u8fc7\u8fd9\u4e9b\u65b9\u6cd5\uff0c\u4f60\u53ef\u4ee5\u786e\u5b9aPython\u662f\u5426\u5df2\u7ecf\u5b89\u88c5\u5728\u4f60\u7684\u7535\u8111\u4e0a\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u63cf\u8ff0\u6bcf\u4e00\u79cd\u65b9\u6cd5\uff0c\u5e76\u89e3\u91ca\u4e3a\u4ec0\u4e48\u5b83\u4eec\u6709\u6548\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u68c0\u67e5\u7cfb\u7edf\u73af\u5883\u53d8\u91cf<\/h3>\n<\/p>\n<p><p>\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u662f\u64cd\u4f5c\u7cfb\u7edf\u7528\u6765\u5b58\u50a8\u7cfb\u7edf\u914d\u7f6e\u4fe1\u606f\u7684\u5730\u65b9\u3002\u5f53\u4f60\u5b89\u88c5Python\u65f6\uff0c\u5b83\u901a\u5e38\u4f1a\u5c06\u81ea\u5df1\u7684\u8def\u5f84\u6dfb\u52a0\u5230\u73af\u5883\u53d8\u91cf\u4e2d\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u68c0\u67e5\u8fd9\u4e9b\u73af\u5883\u53d8\u91cf\u6765\u786e\u5b9a\u662f\u5426\u5b89\u88c5\u4e86Python\u3002<\/p>\n<\/p>\n<p><h4>1. Windows\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u68c0\u67e5\u73af\u5883\u53d8\u91cf\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u53f3\u952e\u70b9\u51fb\u201c\u6b64\u7535\u8111\u201d\u56fe\u6807\uff0c\u7136\u540e\u9009\u62e9\u201c\u5c5e\u6027\u201d\u3002<\/li>\n<li>\u5728\u5f39\u51fa\u7684\u7a97\u53e3\u4e2d\uff0c\u70b9\u51fb\u5de6\u4fa7\u7684\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\u67e5\u770b\u201c\u7cfb\u7edf\u53d8\u91cf\u201d\u5217\u8868\uff0c\u627e\u5230\u540d\u4e3a\u201cPath\u201d\u7684\u53d8\u91cf\u3002<\/li>\n<li>\u53cc\u51fb\u201cPath\u201d\u53d8\u91cf\uff0c\u67e5\u770b\u5176\u4e2d\u662f\u5426\u5305\u542bPython\u7684\u5b89\u88c5\u8def\u5f84\uff0c\u5982<code>C:\\Python39<\/code>\u6216<code>C:\\Users\\YourUsername\\AppData\\Local\\Programs\\Python\\Python39<\/code>\u7b49\u3002<\/li>\n<\/ol>\n<p><h4>2. macOS\u548cLinux\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728macOS\u548cLinux\u7cfb\u7edf\u4e2d\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u68c0\u67e5\u73af\u5883\u53d8\u91cf\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">echo $PATH<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd0\u884c\u4e0a\u8ff0\u547d\u4ee4\u540e\uff0c\u4f60\u4f1a\u770b\u5230\u4e00\u7cfb\u5217\u8def\u5f84\uff0c\u5982\u679c\u5176\u4e2d\u5305\u542bPython\u7684\u8def\u5f84\uff0c\u5982<code>\/usr\/local\/bin\/python3<\/code>\u6216<code>\/usr\/bin\/python<\/code>\uff0c\u5219\u8868\u793aPython\u5df2\u7ecf\u5b89\u88c5\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u4f7f\u7528\u547d\u4ee4\u884c<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528\u547d\u4ee4\u884c\u662f\u68c0\u67e5Python\u662f\u5426\u5b89\u88c5\u7684\u6700\u7b80\u5355\u65b9\u6cd5\u4e4b\u4e00\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165\u7279\u5b9a\u547d\u4ee4\u6765\u67e5\u770bPython\u7248\u672c\u3002<\/p>\n<\/p>\n<p><h4>1. Windows\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08\u53ef\u4ee5\u901a\u8fc7\u6309Win + R\u952e\uff0c\u7136\u540e\u8f93\u5165<code>cmd<\/code>\u5e76\u6309Enter\u952e\uff09\uff0c\u7136\u540e\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6216\u8005<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python3 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679cPython\u5df2\u7ecf\u5b89\u88c5\uff0c\u4f60\u4f1a\u770b\u5230\u7c7b\u4f3c<code>Python 3.x.x<\/code>\u7684\u7248\u672c\u4fe1\u606f\u3002\u5982\u679c\u6ca1\u6709\u5b89\u88c5\uff0c\u4f60\u4f1a\u770b\u5230\u4e00\u6761\u9519\u8bef\u6d88\u606f\uff0c\u63d0\u793a\u627e\u4e0d\u5230\u8be5\u547d\u4ee4\u3002<\/p>\n<\/p>\n<p><h4>2. macOS\u548cLinux\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728macOS\u548cLinux\u7cfb\u7edf\u4e2d\uff0c\u6253\u5f00\u7ec8\u7aef\uff0c\u7136\u540e\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6216\u8005<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python3 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u540c\u6837\uff0c\u5982\u679cPython\u5df2\u7ecf\u5b89\u88c5\uff0c\u4f60\u4f1a\u770b\u5230\u7248\u672c\u4fe1\u606f\u3002\u5982\u679c\u6ca1\u6709\u5b89\u88c5\uff0c\u4f60\u4f1a\u770b\u5230\u4e00\u6761\u9519\u8bef\u6d88\u606f\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u67e5\u770bPython\u6587\u4ef6\u5939<\/h3>\n<\/p>\n<p><p>\u4f60\u8fd8\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u7cfb\u7edf\u4e2d\u7684Python\u6587\u4ef6\u5939\u6765\u786e\u5b9a\u662f\u5426\u5b89\u88c5\u4e86Python\u3002Python\u901a\u5e38\u4f1a\u5b89\u88c5\u5728\u7279\u5b9a\u7684\u76ee\u5f55\u4e2d\uff0c\u4f60\u53ef\u4ee5\u68c0\u67e5\u8fd9\u4e9b\u76ee\u5f55\u662f\u5426\u5b58\u5728\u3002<\/p>\n<\/p>\n<p><h4>1. Windows\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728Windows\u7cfb\u7edf\u4e2d\uff0cPython\u901a\u5e38\u4f1a\u5b89\u88c5\u5728\u4ee5\u4e0b\u8def\u5f84\u4e4b\u4e00\uff1a<\/p>\n<\/p>\n<ul>\n<li><code>C:\\Python39<\/code><\/li>\n<li><code>C:\\Users\\YourUsername\\AppData\\Local\\Programs\\Python\\Python39<\/code><\/li>\n<\/ul>\n<p><p>\u4f60\u53ef\u4ee5\u901a\u8fc7\u6587\u4ef6<a href=\"https:\/\/docs.pingcode.com\/blog\/project-management\/58557.html\" target=\"_blank\">\u8d44\u6e90\u7ba1\u7406<\/a>\u5668\u5bfc\u822a\u5230\u8fd9\u4e9b\u8def\u5f84\uff0c\u67e5\u770b\u662f\u5426\u5b58\u5728Python\u6587\u4ef6\u5939\u3002<\/p>\n<\/p>\n<p><h4>2. macOS\u548cLinux\u7cfb\u7edf<\/h4>\n<\/p>\n<p><p>\u5728macOS\u548cLinux\u7cfb\u7edf\u4e2d\uff0cPython\u901a\u5e38\u4f1a\u5b89\u88c5\u5728\u4ee5\u4e0b\u8def\u5f84\u4e4b\u4e00\uff1a<\/p>\n<\/p>\n<ul>\n<li><code>\/usr\/local\/bin\/python3<\/code><\/li>\n<li><code>\/usr\/bin\/python<\/code><\/li>\n<\/ul>\n<p><p>\u4f60\u53ef\u4ee5\u901a\u8fc7\u6587\u4ef6\u7ba1\u7406\u5668\u6216\u7ec8\u7aef\u5bfc\u822a\u5230\u8fd9\u4e9b\u8def\u5f84\uff0c\u67e5\u770b\u662f\u5426\u5b58\u5728Python\u6587\u4ef6\u5939\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u4f7f\u7528\u7279\u5b9a\u8f6f\u4ef6\u8fdb\u884c\u68c0\u6d4b<\/h3>\n<\/p>\n<p><p>\u6709\u4e00\u4e9b\u8f6f\u4ef6\u53ef\u4ee5\u5e2e\u52a9\u4f60\u68c0\u6d4b\u7cfb\u7edf\u4e2d\u662f\u5426\u5b89\u88c5\u4e86Python\u3002\u8fd9\u4e9b\u8f6f\u4ef6\u901a\u5e38\u4f1a\u626b\u63cf\u4f60\u7684\u7cfb\u7edf\u5e76\u5217\u51fa\u6240\u6709\u5df2\u5b89\u88c5\u7684\u7f16\u7a0b\u8bed\u8a00\u548c\u5de5\u5177\u3002<\/p>\n<\/p>\n<p><h4>1. Anaconda<\/h4>\n<\/p>\n<p><p>Anaconda\u662f\u4e00\u4e2a\u6d41\u884c\u7684\u6570\u636e\u79d1\u5b66\u5e73\u53f0\uff0c\u5b83\u5305\u62ecPython\u548c\u8bb8\u591a\u5e38\u7528\u7684\u5e93\u3002\u5b89\u88c5Anaconda\u540e\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u5b83\u7684\u547d\u4ee4\u884c\u5de5\u5177<code>conda<\/code>\u6765\u68c0\u67e5Python\u7684\u5b89\u88c5\u60c5\u51b5\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">conda list python<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd0\u884c\u4e0a\u8ff0\u547d\u4ee4\uff0c\u4f60\u4f1a\u770b\u5230\u5df2\u5b89\u88c5\u7684Python\u7248\u672c\u4fe1\u606f\u3002<\/p>\n<\/p>\n<p><h4>2. PyCharm<\/h4>\n<\/p>\n<p><p>PyCharm\u662f\u4e00\u4e2a\u6d41\u884c\u7684Python\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u3002\u5b89\u88c5\u5e76\u6253\u5f00PyCharm\u540e\uff0c\u4f60\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u65b0\u9879\u76ee\uff0cPyCharm\u4f1a\u81ea\u52a8\u68c0\u6d4b\u7cfb\u7edf\u4e2d\u662f\u5426\u5b89\u88c5\u4e86Python\uff0c\u5e76\u63d0\u793a\u4f60\u914d\u7f6ePython\u89e3\u91ca\u5668\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u51e0\u79cd\u65b9\u6cd5\uff0c\u4f60\u53ef\u4ee5\u8f7b\u677e\u786e\u5b9a\u4f60\u7684\u7535\u8111\u4e2d\u662f\u5426\u5b89\u88c5\u4e86Python\u3002\u5982\u679c\u53d1\u73b0\u6ca1\u6709\u5b89\u88c5\uff0c\u4f60\u53ef\u4ee5\u524d\u5f80Python\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u5e76\u5b89\u88c5\u6700\u65b0\u7248\u672c\u7684Python\u3002\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u8bf7\u786e\u4fdd\u9009\u62e9\u5c06Python\u6dfb\u52a0\u5230\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u9009\u9879\uff0c\u8fd9\u6837\u53ef\u4ee5\u65b9\u4fbf\u4f60\u5728\u547d\u4ee4\u884c\u4e2d\u4f7f\u7528Python\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u68c0\u67e5\u6211\u7684\u7535\u8111\u4e0a\u662f\u5426\u5df2\u7ecf\u5b89\u88c5\u4e86Python\uff1f<\/strong><br \/>\u8981\u786e\u8ba4\u7535\u8111\u4e2d\u662f\u5426\u5b89\u88c5\u4e86Python\uff0c\u60a8\u53ef\u4ee5\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08Windows\uff09\u6216\u7ec8\u7aef\uff08macOS\/Linux\uff09\uff0c\u7136\u540e\u8f93\u5165 <code>python --version<\/code> \u6216 <code>python3 --version<\/code>\u3002\u5982\u679c\u7cfb\u7edf\u8fd4\u56dePython\u7684\u7248\u672c\u53f7\uff0c\u8bf4\u660ePython\u5df2\u7ecf\u6210\u529f\u5b89\u88c5\u3002\u5982\u679c\u663e\u793a\u201c\u672a\u627e\u5230\u547d\u4ee4\u201d\u6216\u7c7b\u4f3c\u4fe1\u606f\uff0c\u5219\u8868\u793a\u672a\u5b89\u88c5\u3002<\/p>\n<p><strong>Python\u7684\u5b89\u88c5\u8def\u5f84\u5728\u54ea\u91cc\u53ef\u4ee5\u627e\u5230\uff1f<\/strong><br \/>\u5982\u679c\u60a8\u5df2\u7ecf\u5b89\u88c5\u4e86Python\uff0c\u4f46\u4e0d\u786e\u5b9a\u5b83\u7684\u5b89\u88c5\u8def\u5f84\uff0c\u53ef\u4ee5\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u6216\u7ec8\u7aef\u4e2d\u8f93\u5165 <code>where python<\/code>\uff08Windows\uff09\u6216 <code>which python<\/code>\uff08macOS\/Linux\uff09\u3002\u8fd9\u5c06\u663e\u793aPython\u53ef\u6267\u884c\u6587\u4ef6\u7684\u8def\u5f84\uff0c\u5e2e\u52a9\u60a8\u627e\u5230\u5b89\u88c5\u4f4d\u7f6e\u3002<\/p>\n<p><strong>\u5728Windows\u4e0a\u5982\u4f55\u67e5\u770b\u5df2\u5b89\u88c5\u7684Python\u7248\u672c\uff1f<\/strong><br \/>\u5728Windows\u64cd\u4f5c\u7cfb\u7edf\u4e2d\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u63a7\u5236\u9762\u677f\u67e5\u770b\u5df2\u5b89\u88c5\u7684\u7a0b\u5e8f\u3002\u6253\u5f00\u63a7\u5236\u9762\u677f\uff0c\u70b9\u51fb\u201c\u7a0b\u5e8f\u548c\u529f\u80fd\u201d\uff0c\u5728\u5217\u8868\u4e2d\u67e5\u627e\u201cPython\u201d\uff0c\u60a8\u5c06\u80fd\u591f\u770b\u5230\u5b89\u88c5\u7684\u7248\u672c\u3002\u5982\u679c\u60a8\u4f7f\u7528\u7684\u662fAnaconda\u7b49\u5206\u53d1\u7248\uff0c\u4e5f\u53ef\u4ee5\u5728Anaconda Navigator\u4e2d\u68c0\u67e5\u5df2\u5b89\u88c5\u7684Python\u7248\u672c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u77e5\u9053\u7535\u8111\u4e2d\u6709\u6ca1\u6709\u5b89\u88c5Python\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u51e0\u79cd\u65b9\u6cd5\uff1a\u68c0\u67e5\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u3001\u4f7f\u7528\u547d\u4ee4\u884c\u3001\u67e5\u770bPython\u6587\u4ef6\u5939 [&hellip;]","protected":false},"author":3,"featured_media":1068386,"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\/1068373"}],"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=1068373"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1068373\/revisions"}],"predecessor-version":[{"id":1068392,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1068373\/revisions\/1068392"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1068386"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1068373"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1068373"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1068373"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}