{"id":921349,"date":"2024-12-26T14:11:32","date_gmt":"2024-12-26T06:11:32","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/921349.html"},"modified":"2024-12-26T14:11:34","modified_gmt":"2024-12-26T06:11:34","slug":"%e5%a6%82%e4%bd%95%e4%b8%8b%e8%bd%bd%e5%ae%89%e8%a3%85python","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/921349.html","title":{"rendered":"\u5982\u4f55\u4e0b\u8f7d\u5b89\u88c5python"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24210343\/faaa068f-ca27-4ef0-a5d8-06fe0d4a3eba.webp\" alt=\"\u5982\u4f55\u4e0b\u8f7d\u5b89\u88c5python\" \/><\/p>\n<p><p> <strong>\u4e0b\u8f7d\u5b89\u88c5Python\u7684\u6b65\u9aa4\u5305\u62ec\uff1a\u8bbf\u95eePython\u5b98\u7f51\u3001\u9009\u62e9\u9002\u5408\u7684\u7248\u672c\u3001\u4e0b\u8f7d\u5b89\u88c5\u7a0b\u5e8f\u3001\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\u3001\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3002<\/strong> \u5728\u8fd9\u4e94\u4e2a\u6b65\u9aa4\u4e2d\uff0c\u9009\u62e9\u9002\u5408\u7684\u7248\u672c\u662f\u975e\u5e38\u91cd\u8981\u7684\u4e00\u6b65\u3002\u56e0\u4e3a\u4e0d\u540c\u7684Python\u7248\u672c\u53ef\u80fd\u4f1a\u5f71\u54cd\u5230\u4f60\u5c06\u8981\u4f7f\u7528\u7684\u5e93\u548c\u5de5\u5177\u7684\u517c\u5bb9\u6027\u3002\u56e0\u6b64\uff0c\u5728\u9009\u62e9\u7248\u672c\u65f6\uff0c\u5e94\u4ed4\u7ec6\u8bc4\u4f30\u4f60\u7684\u9879\u76ee\u9700\u6c42\u548c\u5f53\u524d\u7684\u6280\u672f\u73af\u5883\u3002<\/p>\n<\/p>\n<p><p>\u9009\u62e9\u9002\u5408\u7684\u7248\u672c\u65f6\uff0c\u4f60\u5e94\u8be5\u8003\u8651\u4f60\u6240\u4f7f\u7528\u7684\u64cd\u4f5c\u7cfb\u7edf\u3001\u4f60\u5c06\u8981\u5f00\u53d1\u7684\u9879\u76ee\u7c7b\u578b\u4ee5\u53ca\u5bf9\u67d0\u4e9b\u7279\u5b9a\u7248\u672c\u7684\u4f9d\u8d56\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u6b63\u5728\u5f00\u53d1\u4e00\u4e2a\u9700\u8981\u4f7f\u7528\u8f83\u65b0\u7279\u6027\u6216\u5e93\u7684\u9879\u76ee\uff0c\u53ef\u80fd\u9700\u8981\u9009\u62e9\u6700\u65b0\u7684Python\u7248\u672c\u3002\u7136\u800c\uff0c\u5982\u679c\u4f60\u7684\u9879\u76ee\u4f9d\u8d56\u4e8e\u67d0\u4e9b\u65e7\u7248\u672c\u7684\u5e93\uff0c\u90a3\u4e48\u9009\u62e9\u4e00\u4e2a\u8f83\u65e7\u7684Python\u7248\u672c\u53ef\u80fd\u4f1a\u66f4\u52a0\u5408\u9002\u3002\u6b64\u5916\uff0c\u67d0\u4e9b\u64cd\u4f5c\u7cfb\u7edf\u53ef\u80fd\u5bf9\u7279\u5b9a\u7684Python\u7248\u672c\u6709\u66f4\u597d\u7684\u652f\u6301\uff0c\u56e0\u6b64\u4e5f\u9700\u8981\u8003\u8651\u8fd9\u4e00\u70b9\u3002<\/p>\n<\/p>\n<hr>\n<p><h3>\u4e00\u3001\u8bbf\u95eePython\u5b98\u7f51<\/h3>\n<\/p>\n<p><p>\u8bbf\u95eePython\u7684\u5b98\u65b9\u7f51\u7ad9\u662f\u4e0b\u8f7d\u5b89\u88c5Python\u7684\u7b2c\u4e00\u6b65\u3002Python\u7684\u5b98\u65b9\u7f51\u7ad9\u63d0\u4f9b\u4e86\u6700\u65b0\u7248\u672c\u7684Python\u5b89\u88c5\u7a0b\u5e8f\uff0c\u4ee5\u53ca\u5386\u53f2\u7248\u672c\u7684\u4e0b\u8f7d\u94fe\u63a5\u3002\u7f51\u7ad9\u754c\u9762\u7b80\u6d01\u660e\u4e86\uff0c\u6613\u4e8e\u5bfc\u822a\u3002\u901a\u8fc7\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7dPython\u53ef\u4ee5\u786e\u4fdd\u4f60\u83b7\u5f97\u7684\u662f\u5b98\u65b9\u7248\u672c\uff0c\u907f\u514d\u4f7f\u7528\u7b2c\u4e09\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u53ef\u80fd\u5bfc\u81f4\u7684\u5b89\u5168\u95ee\u9898\u3002<\/p>\n<\/p>\n<p><p>\u5728\u8bbf\u95ee\u5b98\u7f51\u65f6\uff0c\u4f60\u53ef\u4ee5\u5728\u5bfc\u822a\u680f\u4e2d\u627e\u5230\u201cDownloads\u201d\u9009\u9879\uff0c\u8fd9\u91cc\u63d0\u4f9b\u4e86\u9488\u5bf9\u4e0d\u540c\u64cd\u4f5c\u7cfb\u7edf\u7684Python\u7248\u672c\u4e0b\u8f7d\u94fe\u63a5\u3002\u6839\u636e\u4f60\u7684\u64cd\u4f5c\u7cfb\u7edf\uff0c\u9009\u62e9\u9002\u5408\u7684\u4e0b\u8f7d\u9009\u9879\u3002\u901a\u5e38\uff0c\u5b98\u7f51\u4f1a\u81ea\u52a8\u68c0\u6d4b\u4f60\u7684\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5e76\u63a8\u8350\u9002\u5408\u7684\u7248\u672c\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u9009\u62e9\u9002\u5408\u7684\u7248\u672c<\/h3>\n<\/p>\n<p><p>\u9009\u62e9\u9002\u5408\u7684Python\u7248\u672c\u662f\u4e00\u4e2a\u91cd\u8981\u7684\u6b65\u9aa4\u3002Python\u6709\u4e24\u4e2a\u4e3b\u8981\u7684\u7248\u672c\u7cfb\u5217\uff1aPython 2\u548cPython 3\u3002\u867d\u7136Python 2\u5df2\u7ecf\u4e0d\u518d\u5b98\u65b9\u652f\u6301\uff0c\u4f46\u5728\u4e00\u4e9b\u9057\u7559\u9879\u76ee\u4e2d\u53ef\u80fd\u4ecd\u7136\u88ab\u4f7f\u7528\u3002\u56e0\u6b64\uff0c\u5728\u9009\u62e9\u7248\u672c\u65f6\u9700\u8981\u6839\u636e\u4f60\u7684\u5177\u4f53\u9700\u6c42\u8fdb\u884c\u9009\u62e9\u3002<\/p>\n<\/p>\n<p><p><strong>Python 3<\/strong>\u662f\u76ee\u524d\u5e7f\u6cdb\u4f7f\u7528\u7684\u7248\u672c\uff0c\u5177\u6709\u66f4\u591a\u7684\u7279\u6027\u548c\u66f4\u597d\u7684\u6027\u80fd\u3002\u5982\u679c\u4f60\u662f\u65b0\u624b\u6216\u8005\u6ca1\u6709\u7279\u5b9a\u7684\u7248\u672c\u8981\u6c42\uff0c\u63a8\u8350\u9009\u62e9Python 3\u3002\u5b83\u63d0\u4f9b\u4e86\u66f4\u73b0\u4ee3\u7684\u8bed\u6cd5\u548c\u529f\u80fd\uff0c\u6bd4\u5982\u7c7b\u578b\u63d0\u793a\u3001\u5f02\u6b65\u7f16\u7a0b\u652f\u6301\u7b49\u3002\u6b64\u5916\uff0cPython 3\u4e0e\u8bb8\u591a\u73b0\u4ee3\u5e93\u548c\u5de5\u5177\u66f4\u52a0\u517c\u5bb9\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u4e0b\u8f7d\u5b89\u88c5\u7a0b\u5e8f<\/h3>\n<\/p>\n<p><p>\u4e0b\u8f7dPython\u5b89\u88c5\u7a0b\u5e8f\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u8fc7\u7a0b\u3002\u5728\u5b98\u7f51\u9009\u62e9\u9002\u5408\u4f60\u7684\u64cd\u4f5c\u7cfb\u7edf\u548c\u7248\u672c\u540e\uff0c\u70b9\u51fb\u201cDownload\u201d\u6309\u94ae\u5373\u53ef\u5f00\u59cb\u4e0b\u8f7d\u3002Python\u7684\u5b89\u88c5\u7a0b\u5e8f\u901a\u5e38\u662f\u4e00\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\uff08Windows\u4e0a\u4e3a.exe\uff0cmacOS\u4e0a\u4e3a.pkg\uff0cLinux\u4e0a\u4e3a.tar.xz\u6216\u5176\u4ed6\u683c\u5f0f\uff09\u3002<\/p>\n<\/p>\n<p><p>\u4e0b\u8f7d\u8fc7\u7a0b\u4e2d\uff0c\u8bf7\u786e\u4fdd\u4f60\u7684\u7f51\u7edc\u8fde\u63a5\u7a33\u5b9a\uff0c\u4ee5\u907f\u514d\u4e0b\u8f7d\u6587\u4ef6\u635f\u574f\u3002\u5982\u679c\u4e0b\u8f7d\u901f\u5ea6\u8f83\u6162\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u4f7f\u7528\u5b98\u7f51\u63d0\u4f9b\u7684\u955c\u50cf\u7ad9\u70b9\u8fdb\u884c\u4e0b\u8f7d\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f<\/h3>\n<\/p>\n<p><p>\u8fd0\u884c\u4e0b\u8f7d\u597d\u7684\u5b89\u88c5\u7a0b\u5e8f\u662f\u5b89\u88c5Python\u7684\u5173\u952e\u6b65\u9aa4\u3002\u5728Windows\u4e0a\uff0c\u53cc\u51fb\u4e0b\u8f7d\u7684.exe\u6587\u4ef6\u5373\u53ef\u542f\u52a8\u5b89\u88c5\u5411\u5bfc\u3002\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u4f60\u53ef\u4ee5\u9009\u62e9\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u8fd9\u5c06\u81ea\u52a8\u4e3a\u4f60\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\uff0c\u65b9\u4fbf\u4ee5\u540e\u5728\u547d\u4ee4\u884c\u4e2d\u4f7f\u7528Python\u3002<\/p>\n<\/p>\n<p><p>\u5b89\u88c5\u5411\u5bfc\u4f1a\u5f15\u5bfc\u4f60\u5b8c\u6210\u5b89\u88c5\u8fc7\u7a0b\uff0c\u4f60\u53ef\u4ee5\u9009\u62e9\u9ed8\u8ba4\u8bbe\u7f6e\uff0c\u4e5f\u53ef\u4ee5\u6839\u636e\u9700\u8981\u8fdb\u884c\u81ea\u5b9a\u4e49\u8bbe\u7f6e\u3002\u4f8b\u5982\uff0c\u4f60\u53ef\u4ee5\u9009\u62e9\u5b89\u88c5\u8def\u5f84\u3001\u5b89\u88c5\u7ec4\u4ef6\u7b49\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u4f60\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165<code>python --version<\/code>\u6765\u9a8c\u8bc1\u5b89\u88c5\u662f\u5426\u6210\u529f\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<\/h3>\n<\/p>\n<p><p>\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u662f\u4f7fPython\u5728\u547d\u4ee4\u884c\u4e2d\u53ef\u7528\u7684\u5fc5\u8981\u6b65\u9aa4\u3002\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u5982\u679c\u5728\u5b89\u88c5\u65f6\u672a\u9009\u62e9\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u4f60\u9700\u8981\u624b\u52a8\u6dfb\u52a0Python\u7684\u5b89\u88c5\u8def\u5f84\u5230\u7cfb\u7edf\u7684PATH\u73af\u5883\u53d8\u91cf\u4e2d\u3002<\/p>\n<\/p>\n<p><p>\u5728Linux\u548cmacOS\u7cfb\u7edf\u4e2d\uff0c\u901a\u5e38\u9700\u8981\u5728\u7ec8\u7aef\u4e2d\u7f16\u8f91<code>.bashrc<\/code>\u3001<code>.bash_profile<\/code>\u6216<code>.zshrc<\/code>\u6587\u4ef6\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">export PATH=&quot;\/usr\/local\/bin\/python3:$PATH&quot;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4fdd\u5b58\u6587\u4ef6\u540e\uff0c\u8fd0\u884c<code>source ~\/.bashrc<\/code>\uff08\u6216\u76f8\u5e94\u7684\u6587\u4ef6\uff09\u4ee5\u5e94\u7528\u66f4\u6539\u3002\u5b8c\u6210\u8fd9\u4e9b\u6b65\u9aa4\u540e\uff0c\u4f60\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165<code>python3<\/code>\u6216<code>python<\/code>\u6765\u542f\u52a8Python\u89e3\u91ca\u5668\u3002<\/p>\n<\/p>\n<hr>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u4f60\u5e94\u8be5\u80fd\u591f\u6210\u529f\u4e0b\u8f7d\u5b89\u88c5Python\uff0c\u5e76\u5728\u4f60\u7684\u7cfb\u7edf\u4e0a\u8fd0\u884cPython\u811a\u672c\u3002\u5982\u679c\u4f60\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u9047\u5230\u95ee\u9898\uff0c\u53ef\u4ee5\u67e5\u770bPython\u5b98\u7f51\u7684\u6587\u6863\uff0c\u6216\u8005\u5728\u7f51\u4e0a\u5bfb\u627e\u76f8\u5173\u89e3\u51b3\u65b9\u6848\u3002Python\u793e\u533a\u975e\u5e38\u6d3b\u8dc3\uff0c\u901a\u5e38\u53ef\u4ee5\u627e\u5230\u4e30\u5bcc\u7684\u8d44\u6e90\u548c\u652f\u6301\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u9009\u62e9\u9002\u5408\u7684Python\u7248\u672c\u8fdb\u884c\u4e0b\u8f7d\uff1f<\/strong><br \/>\u5728\u9009\u62e9Python\u7248\u672c\u65f6\uff0c\u60a8\u9700\u8981\u8003\u8651\u60a8\u7684\u64cd\u4f5c\u7cfb\u7edf\uff08Windows\u3001macOS\u6216Linux\uff09\u3001\u6240\u9700\u7684\u529f\u80fd\u4ee5\u53ca\u517c\u5bb9\u6027\u3002\u5bf9\u4e8e\u5927\u591a\u6570\u7528\u6237\uff0c\u5efa\u8bae\u4e0b\u8f7d\u6700\u65b0\u7684\u7a33\u5b9a\u7248\u672c\uff0c\u56e0\u4e3a\u5b83\u4eec\u901a\u5e38\u5305\u542b\u6700\u65b0\u7684\u529f\u80fd\u548c\u5b89\u5168\u4fee\u590d\u3002\u5982\u679c\u60a8\u7684\u9879\u76ee\u4f9d\u8d56\u4e8e\u7279\u5b9a\u7248\u672c\uff0c\u786e\u4fdd\u9009\u62e9\u4e0e\u60a8\u7684\u4f9d\u8d56\u9879\u517c\u5bb9\u7684\u7248\u672c\u3002<\/p>\n<p><strong>\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u9047\u5230\u9519\u8bef\uff0c\u8be5\u5982\u4f55\u89e3\u51b3\uff1f<\/strong><br \/>\u5982\u679c\u5728\u5b89\u88c5Python\u65f6\u9047\u5230\u9519\u8bef\uff0c\u9996\u5148\u68c0\u67e5\u662f\u5426\u6709\u5176\u4ed6\u7a0b\u5e8f\u6b63\u5728\u4f7f\u7528Python\u7684\u76f8\u5173\u6587\u4ef6\u3002\u6b64\u5916\uff0c\u786e\u4fdd\u60a8\u6709\u8db3\u591f\u7684\u6743\u9650\u8fdb\u884c\u5b89\u88c5\u3002\u5982\u679c\u95ee\u9898\u4f9d\u7136\u5b58\u5728\uff0c\u8bbf\u95eePython\u7684\u5b98\u65b9\u6587\u6863\u6216\u793e\u533a\u8bba\u575b\uff0c\u67e5\u627e\u7279\u5b9a\u9519\u8bef\u4ee3\u7801\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u901a\u5e38\u4f1a\u627e\u5230\u5176\u4ed6\u7528\u6237\u7684\u89e3\u51b3\u65b9\u6848\u6216\u5efa\u8bae\u3002<\/p>\n<p><strong>\u5b89\u88c5\u540e\u5982\u4f55\u9a8c\u8bc1Python\u662f\u5426\u6210\u529f\u5b89\u88c5\uff1f<\/strong><br \/>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08Windows\uff09\u6216\u7ec8\u7aef\uff08macOS\/Linux\uff09\uff0c\u8f93\u5165\u547d\u4ee4 <code>python --version<\/code> \u6216 <code>python3 --version<\/code> \u6765\u68c0\u67e5Python\u662f\u5426\u6210\u529f\u5b89\u88c5\u3002\u5982\u679c\u7cfb\u7edf\u6b63\u786e\u8fd4\u56de\u7248\u672c\u53f7\uff0c\u8bf4\u660e\u5b89\u88c5\u6210\u529f\u3002\u5982\u679c\u51fa\u73b0\u9519\u8bef\u4fe1\u606f\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u91cd\u65b0\u5b89\u88c5\u6216\u68c0\u67e5\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u4e0b\u8f7d\u5b89\u88c5Python\u7684\u6b65\u9aa4\u5305\u62ec\uff1a\u8bbf\u95eePython\u5b98\u7f51\u3001\u9009\u62e9\u9002\u5408\u7684\u7248\u672c\u3001\u4e0b\u8f7d\u5b89\u88c5\u7a0b\u5e8f\u3001\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\u3001\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf [&hellip;]","protected":false},"author":3,"featured_media":921352,"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\/921349"}],"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=921349"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/921349\/revisions"}],"predecessor-version":[{"id":921353,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/921349\/revisions\/921353"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/921352"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=921349"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=921349"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=921349"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}