{"id":950327,"date":"2024-12-27T00:32:28","date_gmt":"2024-12-26T16:32:28","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/950327.html"},"modified":"2024-12-27T00:32:30","modified_gmt":"2024-12-26T16:32:30","slug":"%e5%a6%82%e4%bd%95%e4%b8%8b%e8%bd%bdpython-%e8%bd%af%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/950327.html","title":{"rendered":"\u5982\u4f55\u4e0b\u8f7dpython \u8f6f\u4ef6"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25085004\/0b0129e1-33e1-4e29-a47f-5119c804381f.webp\" alt=\"\u5982\u4f55\u4e0b\u8f7dpython \u8f6f\u4ef6\" \/><\/p>\n<p><p> <strong>\u8981\u4e0b\u8f7dPython\u8f6f\u4ef6\uff0c\u60a8\u53ef\u4ee5\u8bbf\u95eePython\u7684\u5b98\u65b9\u7f51\u7ad9\u3001\u9009\u62e9\u5408\u9002\u7684\u7248\u672c\u3001\u4e0b\u8f7d\u5e76\u5b89\u88c5\u8be5\u7248\u672c\u3002<\/strong> \u5728\u9009\u62e9\u7248\u672c\u65f6\uff0c\u8bf7\u786e\u4fdd\u60a8\u9009\u62e9\u7684\u7248\u672c\u4e0e\u60a8\u7684\u64cd\u4f5c\u7cfb\u7edf\u548c\u9700\u6c42\u76f8\u5339\u914d\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u8fdb\u884c\u8fd9\u4e9b\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9<\/p>\n<\/p>\n<p><p>Python\u8f6f\u4ef6\u7684\u4e0b\u8f7d\u901a\u5e38\u901a\u8fc7Python\u7684\u5b98\u65b9\u7f51\u7ad9\u8fdb\u884c\u3002\u60a8\u53ef\u4ee5\u5728\u6d4f\u89c8\u5668\u4e2d\u8f93\u5165\u7f51\u5740\u201c<a href=\"https:\/\/www.python.org\/%E2%80%9D%EF%BC%8C%E7%84%B6%E5%90%8E%E6%8C%89%E5%9B%9E%E8%BD%A6%E9%94%AE%E8%BF%9B%E5%85%A5%E8%AF%A5%E7%BD%91%E7%AB%99%E3%80%82%E5%9C%A8%E7%BD%91%E7%AB%99%E7%9A%84%E9%A6%96%E9%A1%B5%EF%BC%8C%E6%82%A8%E4%BC%9A%E7%9C%8B%E5%88%B0%E2%80%9CDownloads%E2%80%9D%E9%80%89%E9%A1%B9%E3%80%82%E8%BF%99%E4%B8%AA%E9%A1%B5%E9%9D%A2%E6%8F%90%E4%BE%9B%E4%BA%86%E6%9C%80%E6%96%B0%E7%9A%84Python%E7%89%88%E6%9C%AC%E5%92%8C%E5%85%B6%E4%BB%96%E7%9B%B8%E5%85%B3%E8%B5%84%E6%BA%90%E3%80%82\">https:\/\/www.python.org\/\u201d\uff0c\u7136\u540e\u6309\u56de\u8f66\u952e\u8fdb\u5165\u8be5\u7f51\u7ad9\u3002\u5728\u7f51\u7ad9\u7684\u9996\u9875\uff0c\u60a8\u4f1a\u770b\u5230\u201cDownloads\u201d\u9009\u9879\u3002\u8fd9\u4e2a\u9875\u9762\u63d0\u4f9b\u4e86\u6700\u65b0\u7684Python\u7248\u672c\u548c\u5176\u4ed6\u76f8\u5173\u8d44\u6e90\u3002<\/a><\/p>\n<\/p>\n<p><p>\u4e8c\u3001\u9009\u62e9\u5408\u9002\u7684Python\u7248\u672c<\/p>\n<\/p>\n<p><p>\u5728\u4e0b\u8f7d\u9875\u9762\u4e2d\uff0c\u60a8\u9700\u8981\u9009\u62e9\u9002\u5408\u60a8\u64cd\u4f5c\u7cfb\u7edf\u7684Python\u7248\u672c\u3002\u901a\u5e38\uff0cPython\u652f\u6301\u591a\u79cd\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5305\u62ecWindows\u3001macOS\u548cLinux\u3002\u5728\u9009\u62e9\u7248\u672c\u65f6\uff0c\u8bf7\u6ce8\u610f\u4ee5\u4e0b\u51e0\u70b9\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u64cd\u4f5c\u7cfb\u7edf\u517c\u5bb9\u6027<\/strong>\uff1a\u786e\u4fdd\u60a8\u9009\u62e9\u7684Python\u7248\u672c\u517c\u5bb9\u60a8\u7684\u64cd\u4f5c\u7cfb\u7edf\u3002\u5b98\u65b9\u7f51\u7ad9\u4f1a\u81ea\u52a8\u68c0\u6d4b\u60a8\u7684\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5e76\u63a8\u8350\u9002\u5408\u7684\u7248\u672c\u3002\u5982\u679c\u60a8\u9700\u8981\u7279\u5b9a\u7248\u672c\uff0c\u53ef\u4ee5\u5728\u201cView the full list of downloads\u201d\u4e2d\u67e5\u770b\u6240\u6709\u53ef\u7528\u7248\u672c\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>Python 2 vs Python 3<\/strong>\uff1a\u76ee\u524d\uff0cPython 3\u662f\u63a8\u8350\u7684\u7248\u672c\uff0c\u56e0\u4e3aPython 2\u5df2\u7ecf\u505c\u6b62\u652f\u6301\u3002\u5982\u679c\u60a8\u6ca1\u6709\u7279\u6b8a\u7684\u9700\u6c42\uff0c\u5efa\u8bae\u9009\u62e9Python 3\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7a33\u5b9a\u7248\u672c<\/strong>\uff1a\u9009\u62e9\u4e00\u4e2a\u7a33\u5b9a\u7248\u672c\uff0c\u8fd9\u4e9b\u7248\u672c\u901a\u5e38\u7ecf\u8fc7\u5145\u5206\u6d4b\u8bd5\uff0c\u9002\u5408\u751f\u4ea7\u73af\u5883\u4f7f\u7528\u3002\u5b98\u65b9\u7f51\u7ad9\u4e00\u822c\u4f1a\u6807\u8bb0\u6700\u65b0\u7684\u7a33\u5b9a\u7248\u672c\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001\u4e0b\u8f7dPython\u5b89\u88c5\u5305<\/p>\n<\/p>\n<p><p>\u9009\u62e9\u5408\u9002\u7684\u7248\u672c\u540e\uff0c\u70b9\u51fb\u4e0b\u8f7d\u94fe\u63a5\uff0c\u4e0b\u8f7dPython\u5b89\u88c5\u5305\u3002\u4e0b\u8f7d\u7684\u6587\u4ef6\u901a\u5e38\u662f\u4e00\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\uff08\u5728Windows\u4e0a\u662f.exe\u6587\u4ef6\uff0c\u5728macOS\u4e0a\u662f.pkg\u6587\u4ef6\uff0cLinux\u4e0a\u53ef\u80fd\u662f.tar.gz\u6587\u4ef6\uff09\u3002<\/p>\n<\/p>\n<p><p>\u56db\u3001\u5b89\u88c5Python<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>Windows\u7cfb\u7edf<\/strong>\uff1a\u53cc\u51fb\u4e0b\u8f7d\u7684.exe\u6587\u4ef6\uff0c\u542f\u52a8\u5b89\u88c5\u7a0b\u5e8f\u3002\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u5efa\u8bae\u9009\u62e9\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u8fd9\u5c06\u4f7f\u5f97Python\u547d\u4ee4\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e2d\u76f4\u63a5\u4f7f\u7528\u3002\u7136\u540e\u6309\u7167\u63d0\u793a\u5b8c\u6210\u5b89\u88c5\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>macOS\u7cfb\u7edf<\/strong>\uff1a\u53cc\u51fb\u4e0b\u8f7d\u7684.pkg\u6587\u4ef6\uff0c\u542f\u52a8\u5b89\u88c5\u7a0b\u5e8f\uff0c\u6309\u7167\u63d0\u793a\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>Linux\u7cfb\u7edf<\/strong>\uff1a\u4e0b\u8f7d.tar.gz\u6587\u4ef6\u540e\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u7ec8\u7aef\u547d\u4ee4\u89e3\u538b\u5e76\u5b89\u88c5Python\u3002\u6b64\u5916\uff0c\u5927\u591a\u6570Linux\u53d1\u884c\u7248\u7684\u5305\u7ba1\u7406\u5668\u4e2d\u90fd\u53ef\u4ee5\u76f4\u63a5\u5b89\u88c5Python\u3002\u4f8b\u5982\uff0c\u5728Ubuntu\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4<code>sudo apt-get install python3<\/code>\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e94\u3001\u9a8c\u8bc1\u5b89\u88c5<\/p>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u9a8c\u8bc1Python\u662f\u5426\u5b89\u88c5\u6210\u529f\u3002\u5728\u547d\u4ee4\u63d0\u793a\u7b26\uff08Windows\uff09\u6216\u7ec8\u7aef\uff08macOS\/Linux\uff09\u4e2d\u8f93\u5165<code>python --version<\/code>\u6216<code>python3 --version<\/code>\uff0c\u67e5\u770b\u662f\u5426\u6b63\u786e\u663e\u793aPython\u7248\u672c\u3002\u5982\u679c\u663e\u793a\u6b63\u786e\u7684\u7248\u672c\u53f7\uff0c\u8bf4\u660ePython\u5df2\u6210\u529f\u5b89\u88c5\u3002<\/p>\n<\/p>\n<p><p>\u516d\u3001\u914d\u7f6ePython\u73af\u5883<\/p>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u914d\u7f6ePython\u73af\u5883\u4ee5\u4fbf\u4e8e\u5f00\u53d1\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<\/strong>\uff1a\u786e\u4fddPython\u7684\u5b89\u88c5\u8def\u5f84\u6dfb\u52a0\u5230\u7cfb\u7edf\u7684\u73af\u5883\u53d8\u91cf\u4e2d\uff0c\u8fd9\u6837\u53ef\u4ee5\u5728\u4efb\u4f55\u547d\u4ee4\u884c\u7a97\u53e3\u4e2d\u8c03\u7528Python\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5pip<\/strong>\uff1apip\u662fPython\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u901a\u5e38\u4f1a\u4e0ePython\u4e00\u8d77\u5b89\u88c5\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528<code>pip install package_name<\/code>\u547d\u4ee4\u6765\u5b89\u88c5Python\u5e93\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u9009\u62e9IDE\u6216\u6587\u672c\u7f16\u8f91\u5668<\/strong>\uff1a\u9009\u62e9\u4e00\u4e2a\u9002\u5408\u7684\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u6216\u6587\u672c\u7f16\u8f91\u5668\u6765\u7f16\u5199Python\u4ee3\u7801\u3002\u5e38\u7528\u7684IDE\u5305\u62ecPyCharm\u3001VS Code\u7b49\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e03\u3001\u5b89\u88c5\u5e38\u7528\u7684Python\u5e93<\/p>\n<\/p>\n<p><p>Python\u6709\u4e30\u5bcc\u7684\u7b2c\u4e09\u65b9\u5e93\u53ef\u4ee5\u4f7f\u7528\u3002\u5728\u5b89\u88c5Python\u540e\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u5b89\u88c5\u4e00\u4e9b\u5e38\u7528\u7684\u5e93\u6765\u6269\u5c55\u5176\u529f\u80fd\u3002\u4f8b\u5982\uff0c\u5b89\u88c5NumPy\u7528\u4e8e\u79d1\u5b66\u8ba1\u7b97\uff0c\u5b89\u88c5Pandas\u7528\u4e8e\u6570\u636e\u5206\u6790\uff0c\u5b89\u88c5Django\u7528\u4e8eWeb\u5f00\u53d1\u7b49\u3002<\/p>\n<\/p>\n<p><p>\u516b\u3001\u5b66\u4e60Python\u7f16\u7a0b<\/p>\n<\/p>\n<p><p>\u4e0b\u8f7d\u5e76\u5b89\u88c5\u597dPython\u540e\uff0c\u5efa\u8bae\u5f00\u59cb\u5b66\u4e60Python\u7f16\u7a0b\u3002\u53ef\u4ee5\u901a\u8fc7\u5728\u7ebf\u6559\u7a0b\u3001\u4e66\u7c4d\u3001\u89c6\u9891\u8bfe\u7a0b\u7b49\u591a\u79cd\u65b9\u5f0f\u8fdb\u884c\u5b66\u4e60\u3002Python\u6709\u5e7f\u6cdb\u7684\u793e\u533a\u652f\u6301\uff0c\u9047\u5230\u95ee\u9898\u65f6\u53ef\u4ee5\u901a\u8fc7\u641c\u7d22\u6216\u5411\u793e\u533a\u63d0\u95ee\u6765\u5bfb\u6c42\u5e2e\u52a9\u3002<\/p>\n<\/p>\n<p><p>\u603b\u4e4b\uff0c\u4e0b\u8f7d\u548c\u5b89\u88c5Python\u662f\u8fdb\u5165Python\u7f16\u7a0b\u4e16\u754c\u7684\u7b2c\u4e00\u6b65\u3002\u901a\u8fc7\u4e0a\u8ff0\u6b65\u9aa4\uff0c\u60a8\u53ef\u4ee5\u987a\u5229\u4e0b\u8f7d\u5e76\u5b89\u88c5Python\uff0c\u5e76\u5f00\u59cb\u5b66\u4e60\u548c\u5f00\u53d1Python\u5e94\u7528\u3002Python\u7684\u7b80\u5355\u6613\u5b66\u548c\u5f3a\u5927\u529f\u80fd\u4f7f\u5176\u6210\u4e3a\u7f16\u7a0b\u521d\u5b66\u8005\u548c\u4e13\u4e1a\u5f00\u53d1\u8005\u7684\u7406\u60f3\u9009\u62e9\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u9009\u62e9\u9002\u5408\u6211\u7684\u64cd\u4f5c\u7cfb\u7edf\u7684Python\u7248\u672c\uff1f<\/strong><br \/>\u5728\u4e0b\u8f7dPython\u8f6f\u4ef6\u4e4b\u524d\uff0c\u9996\u5148\u9700\u8981\u786e\u8ba4\u81ea\u5df1\u7684\u64cd\u4f5c\u7cfb\u7edf\u7c7b\u578b\u3002Python\u652f\u6301\u591a\u79cd\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5305\u62ecWindows\u3001macOS\u548cLinux\u3002\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9\uff08python.org\uff09\uff0c\u5728\u4e0b\u8f7d\u9875\u9762\u4e0a\u53ef\u4ee5\u770b\u5230\u4e0d\u540c\u7248\u672c\u7684Python\u4f9b\u9009\u62e9\u3002\u786e\u4fdd\u9009\u62e9\u4e0e\u60a8\u64cd\u4f5c\u7cfb\u7edf\u76f8\u5339\u914d\u7684\u5b89\u88c5\u5305\uff0c\u4ee5\u907f\u514d\u517c\u5bb9\u6027\u95ee\u9898\u3002<\/p>\n<p><strong>\u4e0b\u8f7dPython\u540e\uff0c\u6211\u8be5\u5982\u4f55\u5b89\u88c5\u5b83\uff1f<\/strong><br \/>\u4e0b\u8f7d\u5b8c\u9002\u5408\u60a8\u64cd\u4f5c\u7cfb\u7edf\u7684Python\u5b89\u88c5\u5305\u540e\uff0c\u6253\u5f00\u4e0b\u8f7d\u7684\u6587\u4ef6\u5e76\u6309\u7167\u5c4f\u5e55\u4e0a\u7684\u6307\u793a\u8fdb\u884c\u5b89\u88c5\u3002\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u5efa\u8bae\u52fe\u9009\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u8fd9\u6837\u53ef\u4ee5\u65b9\u4fbf\u5728\u547d\u4ee4\u884c\u4e2d\u76f4\u63a5\u4f7f\u7528Python\u3002\u6b64\u5916\uff0c\u60a8\u8fd8\u53ef\u4ee5\u9009\u62e9\u5b89\u88c5pip\uff0c\u8fd9\u662fPython\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u65b9\u4fbf\u540e\u7eed\u5b89\u88c5\u5176\u4ed6\u5e93\u548c\u6a21\u5757\u3002<\/p>\n<p><strong>\u6211\u5982\u4f55\u786e\u8ba4Python\u5b89\u88c5\u6210\u529f\uff1f<\/strong><br \/>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u6216\u7ec8\u7aef\u6765\u68c0\u67e5Python\u662f\u5426\u5b89\u88c5\u6210\u529f\u3002\u6253\u5f00\u547d\u4ee4\u884c\u7a97\u53e3\uff08Windows\uff09\u6216\u7ec8\u7aef\uff08macOS\/Linux\uff09\uff0c\u8f93\u5165<code>python --version<\/code>\u6216<code>python3 --version<\/code>\uff0c\u6309\u4e0b\u56de\u8f66\u3002\u5982\u679c\u770b\u5230Python\u7248\u672c\u53f7\u7684\u663e\u793a\uff0c\u8bf4\u660e\u5b89\u88c5\u6210\u529f\u3002\u5982\u679c\u51fa\u73b0\u672a\u8bc6\u522b\u7684\u547d\u4ee4\uff0c\u53ef\u80fd\u662f\u6ca1\u6709\u6b63\u786e\u6dfb\u52a0\u5230\u73af\u5883\u53d8\u91cf\u4e2d\uff0c\u9700\u91cd\u65b0\u68c0\u67e5\u5b89\u88c5\u6b65\u9aa4\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u4e0b\u8f7dPython\u8f6f\u4ef6\uff0c\u60a8\u53ef\u4ee5\u8bbf\u95eePython\u7684\u5b98\u65b9\u7f51\u7ad9\u3001\u9009\u62e9\u5408\u9002\u7684\u7248\u672c\u3001\u4e0b\u8f7d\u5e76\u5b89\u88c5\u8be5\u7248\u672c\u3002 \u5728\u9009\u62e9\u7248\u672c\u65f6\uff0c\u8bf7 [&hellip;]","protected":false},"author":3,"featured_media":950331,"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\/950327"}],"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=950327"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/950327\/revisions"}],"predecessor-version":[{"id":950335,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/950327\/revisions\/950335"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/950331"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=950327"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=950327"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=950327"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}