{"id":964016,"date":"2024-12-27T04:24:09","date_gmt":"2024-12-26T20:24:09","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/964016.html"},"modified":"2024-12-27T04:24:11","modified_gmt":"2024-12-26T20:24:11","slug":"%e5%a6%82%e4%bd%95%e4%b8%8b%e8%bd%bdpython%e5%b9%b6%e4%bd%bf%e7%94%a8","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/964016.html","title":{"rendered":"\u5982\u4f55\u4e0b\u8f7dpython\u5e76\u4f7f\u7528"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24181030\/ae117086-636e-4e9a-8aea-80a0cc90a417.webp\" alt=\"\u5982\u4f55\u4e0b\u8f7dpython\u5e76\u4f7f\u7528\" \/><\/p>\n<p><p> <strong>\u8981\u4e0b\u8f7d\u5e76\u4f7f\u7528Python\uff0c\u4f60\u9700\u8981\uff1a\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9\u3001\u9009\u62e9\u5408\u9002\u7684Python\u7248\u672c\u3001\u4e0b\u8f7d\u5b89\u88c5\u5305\u5e76\u8fdb\u884c\u5b89\u88c5\u3001\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3001\u6d4b\u8bd5\u5b89\u88c5\u6210\u529f\u4e0e\u5426\u3002<\/strong>\u5728\u8fd9\u4e9b\u6b65\u9aa4\u4e2d\uff0c\u9009\u62e9\u5408\u9002\u7684Python\u7248\u672c\u5c24\u5176\u91cd\u8981\uff0c\u56e0\u4e3a\u4e0d\u540c\u7684\u9879\u76ee\u53ef\u80fd\u9700\u8981\u4e0d\u540c\u7684\u7248\u672c\uff0c\u9009\u62e9\u4e0d\u5f53\u53ef\u80fd\u5bfc\u81f4\u517c\u5bb9\u6027\u95ee\u9898\u3002\u5927\u90e8\u5206\u60c5\u51b5\u4e0b\uff0c\u5efa\u8bae\u4f7f\u7528Python\u7684\u6700\u65b0\u7a33\u5b9a\u7248\u672c\uff0c\u56e0\u4e3a\u5b83\u5305\u542b\u6700\u65b0\u7684\u529f\u80fd\u548c\u5b89\u5168\u66f4\u65b0\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u5b8c\u6210\u6bcf\u4e2a\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9<\/p>\n<\/p>\n<p><p>\u8981\u4e0b\u8f7dPython\uff0c\u9996\u5148\u9700\u8981\u8bbf\u95ee\u5176\u5b98\u65b9\u7f51\u7ad9\uff08<a href=\"https:\/\/www.python.org\/%EF%BC%89%E3%80%82Python%E5%AE%98%E7%BD%91%E6%8F%90%E4%BE%9B%E4%BA%86%E6%89%80%E6%9C%89%E5%8F%AF%E7%94%A8%E7%89%88%E6%9C%AC%E7%9A%84%E4%B8%8B%E8%BD%BD%E9%93%BE%E6%8E%A5%EF%BC%8C%E4%BB%A5%E5%8F%8A%E5%A4%A7%E9%87%8F%E7%9A%84%E6%96%87%E6%A1%A3%E5%92%8C%E8%B5%84%E6%BA%90%E3%80%82\">https:\/\/www.python.org\/\uff09\u3002Python\u5b98\u7f51\u63d0\u4f9b\u4e86\u6240\u6709\u53ef\u7528\u7248\u672c\u7684\u4e0b\u8f7d\u94fe\u63a5\uff0c\u4ee5\u53ca\u5927\u91cf\u7684\u6587\u6863\u548c\u8d44\u6e90\u3002<\/a><\/p>\n<\/p>\n<p><p>Python\u5b98\u7f51\u7684\u9996\u9875\u4e2d\uff0c\u901a\u5e38\u4f1a\u6709\u4e00\u4e2a\u201cDownloads\u201d\u83dc\u5355\uff0c\u4f60\u53ef\u4ee5\u5728\u8fd9\u4e2a\u83dc\u5355\u4e0b\u627e\u5230\u6700\u65b0\u7684\u7a33\u5b9a\u7248\u672c\u3002\u503c\u5f97\u6ce8\u610f\u7684\u662f\uff0c\u5b98\u65b9\u7f51\u7ad9\u4f1a\u6839\u636e\u4f60\u7684\u64cd\u4f5c\u7cfb\u7edf\u81ea\u52a8\u63a8\u8350\u5408\u9002\u7684\u7248\u672c\u3002<\/p>\n<\/p>\n<p><p>\u4e8c\u3001\u9009\u62e9\u5408\u9002\u7684Python\u7248\u672c<\/p>\n<\/p>\n<p><p>\u5728\u4e0b\u8f7dPython\u4e4b\u524d\uff0c\u9009\u62e9\u5408\u9002\u7684\u7248\u672c\u662f\u81f3\u5173\u91cd\u8981\u7684\u3002Python\u6709\u4e24\u4e2a\u4e3b\u8981\u7248\u672c\u7cfb\u5217\uff1aPython 2.x\u548cPython 3.x\u3002Python 2.x\u5df2\u57282020\u5e74\u505c\u6b62\u652f\u6301\uff0c\u56e0\u6b64\u5efa\u8bae\u9009\u62e9Python 3.x\u7248\u672c\u3002<\/p>\n<\/p>\n<p><p>\u5728\u9009\u62e9Python 3.x\u7684\u5177\u4f53\u7248\u672c\u65f6\uff0c\u5c3d\u91cf\u9009\u62e9\u6700\u65b0\u7684\u7a33\u5b9a\u7248\u672c\uff0c\u56e0\u4e3a\u5b83\u4eec\u901a\u5e38\u5305\u542b\u4e86\u6700\u65b0\u7684\u529f\u80fd\u548c\u5b89\u5168\u4fee\u590d\u3002\u4e0e\u6b64\u540c\u65f6\uff0c\u786e\u4fdd\u4f60\u9009\u62e9\u7684\u7248\u672c\u4e0e\u9879\u76ee\u7684\u4f9d\u8d56\u9700\u6c42\u517c\u5bb9\u3002<\/p>\n<\/p>\n<p><p>\u4e09\u3001\u4e0b\u8f7d\u5b89\u88c5\u5305\u5e76\u8fdb\u884c\u5b89\u88c5<\/p>\n<\/p>\n<p><p>\u5728\u9009\u62e9\u597d\u9002\u5408\u7684\u7248\u672c\u540e\uff0c\u70b9\u51fb\u4e0b\u8f7d\u6309\u94ae\uff0c\u4e0b\u8f7d\u9002\u5408\u4f60\u64cd\u4f5c\u7cfb\u7edf\u7684\u5b89\u88c5\u5305\u3002\u4e0d\u540c\u64cd\u4f5c\u7cfb\u7edf\u7684\u5b89\u88c5\u5305\u683c\u5f0f\u53ef\u80fd\u4e0d\u540c\uff0c\u4f8b\u5982Windows\u7684\u5b89\u88c5\u5305\u901a\u5e38\u662f\u4e00\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\uff08.exe\uff09\uff0c\u800cMacOS\u5219\u53ef\u80fd\u662f\u4e00\u4e2a.dmg\u6587\u4ef6\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>Windows\u5b89\u88c5<\/strong><\/p>\n<\/p>\n<p><p>\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\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\u540e\u7eed\u7684\u547d\u4ee4\u884c\u4f7f\u7528\u3002\u9009\u62e9\u201cCustomize installation\u201d\u53ef\u4ee5\u67e5\u770b\u6216\u4fee\u6539\u9ed8\u8ba4\u5b89\u88c5\u8bbe\u7f6e\uff0c\u4f8b\u5982\u5b89\u88c5\u8def\u5f84\u3001\u662f\u5426\u5b89\u88c5pip\u7b49\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>MacOS\u5b89\u88c5<\/strong><\/p>\n<\/p>\n<p><p>\u5bf9\u4e8eMacOS\uff0c\u4e0b\u8f7d.dmg\u6587\u4ef6\u540e\uff0c\u6253\u5f00\u5b83\u5e76\u5c06Python\u62d6\u52a8\u5230\u5e94\u7528\u7a0b\u5e8f\u6587\u4ef6\u5939\u4e2d\u5373\u53ef\u5b8c\u6210\u5b89\u88c5\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>Linux\u5b89\u88c5<\/strong><\/p>\n<\/p>\n<p><p>\u5728Linux\u4e0a\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u8fdb\u884c\u5b89\u88c5\uff0c\u4f8b\u5982\u5728Ubuntu\u4e0a\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4<code>sudo apt-get install python3<\/code>\u3002\u8fd9\u79cd\u65b9\u6cd5\u4f1a\u81ea\u52a8\u5904\u7406\u4f9d\u8d56\u5173\u7cfb\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u56db\u3001\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<\/p>\n<\/p>\n<p><p>\u5728Windows\u4e0a\uff0c\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u53ef\u4ee5\u8ba9\u4f60\u5728\u547d\u4ee4\u884c\u4e2d\u76f4\u63a5\u4f7f\u7528Python\u547d\u4ee4\u3002\u5c3d\u7ba1\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u53ef\u4ee5\u81ea\u52a8\u6dfb\u52a0\u73af\u5883\u53d8\u91cf\uff0c\u4f46\u5982\u679c\u6ca1\u6709\u9009\u62e9\u8be5\u9009\u9879\uff0c\u4f60\u9700\u8981\u624b\u52a8\u8bbe\u7f6e\u3002<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u63a7\u5236\u9762\u677f\uff0c\u9009\u62e9\u201c\u7cfb\u7edf\u548c\u5b89\u5168\u201d\u3002<\/li>\n<li>\u9009\u62e9\u201c\u7cfb\u7edf\u201d\uff0c\u7136\u540e\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\u3002<\/li>\n<li>\u5728\u201c\u7cfb\u7edf\u53d8\u91cf\u201d\u90e8\u5206\uff0c\u627e\u5230\u5e76\u9009\u62e9\u201cPath\u201d\uff0c\u70b9\u51fb\u201c\u7f16\u8f91\u201d\u3002<\/li>\n<li>\u70b9\u51fb\u201c\u65b0\u5efa\u201d\uff0c\u5e76\u8f93\u5165Python\u7684\u5b89\u88c5\u8def\u5f84\uff0c\u4f8b\u5982<code>C:\\Python39<\/code>\u3002<\/li>\n<li>\u786e\u8ba4\u5e76\u4fdd\u5b58\u4fee\u6539\u3002<\/li>\n<\/ol>\n<p><p>\u4e94\u3001\u6d4b\u8bd5\u5b89\u88c5\u6210\u529f\u4e0e\u5426<\/p>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\uff08Windows\u7684\u547d\u4ee4\u63d0\u793a\u7b26\uff0cMac\u548cLinux\u7684\u7ec8\u7aef\uff09\u6d4b\u8bd5Python\u662f\u5426\u5b89\u88c5\u6210\u529f\u3002<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u547d\u4ee4\u884c\u7a97\u53e3\uff0c\u8f93\u5165<code>python --version<\/code>\u6216<code>python3 --version<\/code>\uff0c\u67e5\u770b\u8f93\u51fa\u7684Python\u7248\u672c\u4fe1\u606f\u3002<\/li>\n<li>\u8f93\u5165<code>python<\/code>\u6216<code>python3<\/code>\uff0c\u8fdb\u5165Python\u89e3\u91ca\u5668\uff0c\u8f93\u5165<code>print(&quot;Hello, World!&quot;)<\/code>\uff0c\u67e5\u770b\u662f\u5426\u8f93\u51fa\u6b63\u786e\u7684\u7ed3\u679c\u3002<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u4f60\u5df2\u7ecf\u6210\u529f\u4e0b\u8f7d\u5e76\u5b89\u88c5\u4e86Python\uff0c\u5e76\u53ef\u4ee5\u5f00\u59cb\u4f7f\u7528\u5b83\u8fdb\u884c\u5f00\u53d1\u4e86\u3002\u63a5\u4e0b\u6765\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u5b89\u88c5\u4e00\u4e9b\u5e38\u7528\u7684Python\u5e93\uff0c\u4f8b\u5982NumPy\u3001Pandas\u7b49\uff0c\u4ee5\u4fbf\u4e8e\u8fdb\u884c\u66f4\u590d\u6742\u7684\u5f00\u53d1\u4efb\u52a1\u3002\u5b89\u88c5\u5e93\u53ef\u4ee5\u4f7f\u7528pip\u5de5\u5177\uff0c\u901a\u8fc7\u547d\u4ee4<code>pip install package_name<\/code>\u6765\u5b9e\u73b0\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u9009\u62e9\u5408\u9002\u7684Python\u7248\u672c\u8fdb\u884c\u4e0b\u8f7d\uff1f<\/strong><br \/>\u5728\u4e0b\u8f7dPython\u65f6\uff0c\u9009\u62e9\u5408\u9002\u7684\u7248\u672c\u81f3\u5173\u91cd\u8981\u3002\u5efa\u8bae\u4e0b\u8f7d\u6700\u65b0\u7684\u7a33\u5b9a\u7248\u672c\uff0c\u4ee5\u786e\u4fdd\u60a8\u53ef\u4ee5\u4f7f\u7528\u6700\u65b0\u7684\u529f\u80fd\u548c\u5b89\u5168\u66f4\u65b0\u3002\u5bf9\u4e8e\u521d\u5b66\u8005\uff0cPython 3.x\u7cfb\u5217\u662f\u63a8\u8350\u7684\u9009\u62e9\uff0c\u56e0\u4e3aPython 2.x\u5df2\u4e8e2020\u5e74\u505c\u6b62\u652f\u6301\u3002\u60a8\u53ef\u4ee5\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9\uff0c\u67e5\u770b\u63a8\u8350\u7684\u7248\u672c\u5e76\u4e0b\u8f7d\u76f8\u5e94\u7684\u5b89\u88c5\u5305\u3002<\/p>\n<p><strong>\u5b89\u88c5Python\u540e\uff0c\u6211\u5e94\u8be5\u5982\u4f55\u914d\u7f6e\u73af\u5883\u53d8\u91cf\uff1f<\/strong><br \/>\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u5b89\u88c5Python\u65f6\u4f1a\u51fa\u73b0\u4e00\u4e2a\u9009\u9879\uff0c\u8ba9\u60a8\u9009\u62e9\u662f\u5426\u5c06Python\u6dfb\u52a0\u5230\u7cfb\u7edf\u7684\u73af\u5883\u53d8\u91cf\u4e2d\u3002\u9009\u62e9\u6b64\u9009\u9879\u540e\uff0c\u60a8\u53ef\u4ee5\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u76f4\u63a5\u8fd0\u884cPython\u547d\u4ee4\u3002\u5982\u679c\u672a\u9009\u62e9\u6b64\u9009\u9879\uff0c\u53ef\u4ee5\u624b\u52a8\u6dfb\u52a0Python\u7684\u5b89\u88c5\u8def\u5f84\u5230\u7cfb\u7edf\u7684\u73af\u5883\u53d8\u91cf\u4e2d\uff0c\u4ee5\u4fbf\u4e8e\u5728\u4efb\u4f55\u7ec8\u7aef\u7a97\u53e3\u4e2d\u8bbf\u95eePython\u3002<\/p>\n<p><strong>\u5982\u4f55\u5f00\u59cb\u4f7f\u7528Python\u7f16\u5199\u4ee3\u7801\uff1f<\/strong><br \/>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u60a8\u53ef\u4ee5\u9009\u62e9\u51e0\u79cd\u65b9\u5f0f\u6765\u7f16\u5199Python\u4ee3\u7801\u3002\u6700\u7b80\u5355\u7684\u65b9\u6cd5\u662f\u4f7f\u7528IDLE\uff0c\u8fd9\u662fPython\u81ea\u5e26\u7684\u96c6\u6210\u5f00\u53d1\u73af\u5883\u3002\u60a8\u8fd8\u53ef\u4ee5\u4e0b\u8f7d\u5176\u4ed6\u6587\u672c\u7f16\u8f91\u5668\u6216IDE\uff0c\u5982PyCharm\u3001Visual Studio Code\u7b49\uff0c\u6765\u63d0\u5347\u7f16\u7801\u4f53\u9a8c\u3002\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Python\u6587\u4ef6\uff08.py\uff09\uff0c\u5728\u5176\u4e2d\u7f16\u5199\u4ee3\u7801\uff0c\u7136\u540e\u901a\u8fc7\u547d\u4ee4\u884c\u6216IDE\u8fd0\u884c\u8be5\u6587\u4ef6\uff0c\u4fbf\u53ef\u5f00\u59cb\u60a8\u7684Python\u7f16\u7a0b\u4e4b\u65c5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u4e0b\u8f7d\u5e76\u4f7f\u7528Python\uff0c\u4f60\u9700\u8981\uff1a\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9\u3001\u9009\u62e9\u5408\u9002\u7684Python\u7248\u672c\u3001\u4e0b\u8f7d\u5b89\u88c5\u5305\u5e76\u8fdb\u884c\u5b89\u88c5\u3001 [&hellip;]","protected":false},"author":3,"featured_media":964018,"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\/964016"}],"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=964016"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/964016\/revisions"}],"predecessor-version":[{"id":964019,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/964016\/revisions\/964019"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/964018"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=964016"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=964016"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=964016"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}