{"id":1019257,"date":"2024-12-27T12:55:18","date_gmt":"2024-12-27T04:55:18","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1019257.html"},"modified":"2024-12-27T12:55:39","modified_gmt":"2024-12-27T04:55:39","slug":"%e5%a6%82%e4%bd%95%e6%9f%a5%e7%9c%8bpython%e6%98%af%e5%90%a6%e8%bf%87%e6%9c%9f","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1019257.html","title":{"rendered":"\u5982\u4f55\u67e5\u770bpython\u662f\u5426\u8fc7\u671f"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25161809\/dfef5033-ed13-4bb9-8c5e-8f840dcff1b6.webp\" alt=\"\u5982\u4f55\u67e5\u770bpython\u662f\u5426\u8fc7\u671f\" \/><\/p>\n<p><p> \u8981\u67e5\u770bPython\u662f\u5426\u8fc7\u671f\uff0c\u53ef\u4ee5\u901a\u8fc7<strong>\u68c0\u67e5\u5f53\u524d\u5b89\u88c5\u7684Python\u7248\u672c\u3001\u5bf9\u6bd4\u5f53\u524d\u7248\u672c\u4e0e\u6700\u65b0\u7248\u672c\u3001\u5173\u6ce8\u5b89\u5168\u516c\u544a<\/strong>\u7b49\u65b9\u6cd5\u6765\u5224\u65ad\u3002\u9996\u5148\uff0c\u786e\u8ba4\u4f60\u5f53\u524d\u4f7f\u7528\u7684Python\u7248\u672c\uff0c\u8fd9\u662f\u5224\u65ad\u662f\u5426\u8fc7\u671f\u7684\u57fa\u7840\u3002\u5176\u6b21\uff0c\u901a\u8fc7\u5bf9\u6bd4\u5b98\u65b9\u7f51\u7ad9\u53d1\u5e03\u7684\u6700\u65b0\u7248\u672c\uff0c\u786e\u5b9a\u662f\u5426\u9700\u8981\u66f4\u65b0\u3002\u6700\u540e\uff0c\u5b9a\u671f\u5173\u6ce8Python\u7684\u5b89\u5168\u516c\u544a\u548c\u652f\u6301\u5468\u671f\u8868\uff0c\u4ee5\u786e\u4fdd\u4f60\u7684Python\u7248\u672c\u5728\u652f\u6301\u5468\u671f\u5185\uff0c\u907f\u514d\u56e0\u4e3a\u4f7f\u7528\u8fc7\u671f\u7248\u672c\u800c\u5e26\u6765\u7684\u5b89\u5168\u98ce\u9669\u3002<\/p>\n<\/p>\n<p><h3>\u68c0\u67e5\u5f53\u524d\u5b89\u88c5\u7684Python\u7248\u672c<\/h3>\n<\/p>\n<p><p>\u8981\u4e86\u89e3\u4f60\u5f53\u524d\u4f7f\u7528\u7684Python\u7248\u672c\uff0c\u6700\u76f4\u63a5\u7684\u65b9\u6cd5\u662f\u901a\u8fc7\u547d\u4ee4\u884c\u5de5\u5177\u8fdb\u884c\u68c0\u67e5\u3002\u65e0\u8bba\u662f\u5728Windows\u3001macOS\u8fd8\u662fLinux\u7cfb\u7edf\u4e2d\uff0c\u90fd\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u5feb\u901f\u67e5\u627e\uff1a<\/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\u53ef\u4ee5\u901a\u8fc7\u5728\u201c\u5f00\u59cb\u201d\u83dc\u5355\u4e2d\u641c\u7d22\u201ccmd\u201d\u627e\u5230\uff09\u3002<\/li>\n<li>\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u5e76\u6309\u4e0b\u56de\u8f66\uff1a\n<pre><code class=\"language-bash\">python --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u5982\u679c\u5b89\u88c5\u4e86Python\uff0c\u547d\u4ee4\u63d0\u793a\u7b26\u4f1a\u8fd4\u56de\u5f53\u524d\u5b89\u88c5\u7684Python\u7248\u672c\u53f7\uff0c\u4f8b\u5982\u201cPython 3.9.1\u201d\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\u4ee5\u4e0b\u547d\u4ee4\u5e76\u6309\u4e0b\u56de\u8f66\uff1a\n<pre><code class=\"language-bash\">python3 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u7cfb\u7edf\u5c06\u8fd4\u56de\u5f53\u524d\u5b89\u88c5\u7684Python 3\u7248\u672c\u53f7\uff0c\u4f8b\u5982\u201cPython 3.8.5\u201d\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><h3>\u5bf9\u6bd4\u5f53\u524d\u7248\u672c\u4e0e\u6700\u65b0\u7248\u672c<\/h3>\n<\/p>\n<p><p>\u4e00\u65e6\u77e5\u9053\u4e86\u5f53\u524d\u7684Python\u7248\u672c\u53f7\uff0c\u63a5\u4e0b\u6765\u9700\u8981\u5728Python\u5b98\u65b9\u7f51\u7ad9\u4e0a\u67e5\u770b\u6700\u65b0\u7684\u7a33\u5b9a\u7248\u672c\u4fe1\u606f\u3002Python\u7684\u5b98\u65b9\u7f51\u7ad9\u63d0\u4f9b\u4e86\u6240\u6709\u7248\u672c\u7684\u53d1\u5e03\u4fe1\u606f\uff0c\u5305\u62ec\u5176\u652f\u6301\u7684\u751f\u547d\u5468\u671f\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u6253\u5f00\u6d4f\u89c8\u5668\u8bbf\u95ee<a href=\"https:\/\/www.python.org\/\">Python\u5b98\u65b9\u7f51\u7ad9<\/a>\uff0c\u7136\u540e\u5bfc\u822a\u5230\u201cDownloads\u201d\u9875\u9762\u3002<\/li>\n<li>\u5728\u6b64\u9875\u9762\u4e2d\uff0c\u4f60\u53ef\u4ee5\u770b\u5230\u6700\u65b0\u7684Python\u7248\u672c\u548c\u5176\u53d1\u5e03\u4fe1\u606f\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u5bf9\u6bd4\u7248\u672c\u53f7<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u68c0\u67e5\u4f60\u7684\u5f53\u524d\u7248\u672c\u53f7\u662f\u5426\u662f\u6700\u65b0\u7684\u7a33\u5b9a\u7248\u672c\u6216\u662f\u4ecd\u5728\u652f\u6301\u751f\u547d\u5468\u671f\u4e2d\u7684\u7248\u672c\u3002<\/li>\n<li>\u5982\u679c\u4f60\u7684\u7248\u672c\u4f4e\u4e8e\u5b98\u65b9\u7f51\u7ad9\u516c\u5e03\u7684\u6700\u65b0\u7248\u672c\uff0c\u5e76\u4e14\u4e0d\u5728\u652f\u6301\u751f\u547d\u5468\u671f\u4e2d\uff0c\u5efa\u8bae\u4f60\u8003\u8651\u66f4\u65b0\u4f60\u7684Python\u7248\u672c\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><h3>\u5173\u6ce8\u5b89\u5168\u516c\u544a\u548c\u652f\u6301\u5468\u671f<\/h3>\n<\/p>\n<p><p>Python\u7684\u6bcf\u4e2a\u7248\u672c\u90fd\u6709\u4e00\u4e2a\u652f\u6301\u5468\u671f\uff0c\u901a\u5e38\u5305\u62ec\u4e00\u4e2a\u4e3b\u6d41\u652f\u6301\u671f\u548c\u4e00\u4e2a\u6269\u5c55\u652f\u6301\u671f\u3002\u5728\u4e3b\u6d41\u652f\u6301\u671f\u5185\uff0c\u7248\u672c\u5c06\u83b7\u5f97\u529f\u80fd\u66f4\u65b0\u548c\u5b89\u5168\u8865\u4e01\uff0c\u800c\u5728\u6269\u5c55\u652f\u6301\u671f\u5185\uff0c\u901a\u5e38\u53ea\u4f1a\u63a5\u6536\u5b89\u5168\u8865\u4e01\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u67e5\u770bPython\u7684\u7248\u672c\u652f\u6301\u653f\u7b56<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u8bbf\u95eePython\u5f00\u53d1\u8005\u7684<a href=\"https:\/\/devguide.python.org\/\">\u53d1\u5e03\u5468\u671f\u548c\u652f\u6301\u653f\u7b56\u9875\u9762<\/a>\u3002<\/li>\n<li>\u4e86\u89e3\u6bcf\u4e2a\u7248\u672c\u7684\u4e3b\u6d41\u652f\u6301\u671f\u548c\u6269\u5c55\u652f\u6301\u671f\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u8ba2\u9605\u5b89\u5168\u516c\u544a<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u53ef\u4ee5\u901a\u8fc7\u8ba2\u9605Python\u7684\u90ae\u4ef6\u5217\u8868\u6216RSS\u8ba2\u9605\u6765\u83b7\u53d6\u5b89\u5168\u516c\u544a\u3002<\/li>\n<li>\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u5728\u53d1\u73b0\u4efb\u4f55\u5b89\u5168\u6f0f\u6d1e\u65f6\uff0c\u4f60\u80fd\u53ca\u65f6\u66f4\u65b0\u5230\u5b89\u5168\u7248\u672c\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><h3>\u4e3a\u4ec0\u4e48\u4fdd\u6301Python\u7248\u672c\u66f4\u65b0\u5f88\u91cd\u8981<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528\u6700\u65b0\u7248\u672c\u7684Python\u4e0d\u4ec5\u53ef\u4ee5\u63d0\u9ad8\u7a0b\u5e8f\u7684\u6027\u80fd\u548c\u529f\u80fd\uff0c\u8fd8\u80fd\u786e\u4fdd\u7a0b\u5e8f\u7684\u5b89\u5168\u6027\u3002\u8bb8\u591a\u7a0b\u5e8f\u5458\u53ef\u80fd\u4e60\u60ef\u4e8e\u4f7f\u7528\u67d0\u4e2a\u7279\u5b9a\u7248\u672c\u7684Python\uff0c\u56e0\u4e3a\u5176\u4e0e\u73b0\u6709\u9879\u76ee\u517c\u5bb9\u3002\u7136\u800c\uff0c\u4f7f\u7528\u4e0d\u518d\u652f\u6301\u7684\u7248\u672c\u53ef\u80fd\u5e26\u6765\u5b89\u5168\u98ce\u9669\uff0c\u56e0\u4e3a\u4e0d\u518d\u63a5\u6536\u5b89\u5168\u8865\u4e01\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u529f\u80fd\u66f4\u65b0<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u6bcf\u4e2a\u65b0\u7684Python\u7248\u672c\u90fd\u4f1a\u5e26\u6765\u65b0\u7684\u529f\u80fd\u548c\u6027\u80fd\u6539\u8fdb\u3002\u4f7f\u7528\u6700\u65b0\u7248\u672c\u53ef\u4ee5\u4f7f\u4f60\u5229\u7528\u8fd9\u4e9b\u65b0\u529f\u80fd\u6765\u7f16\u5199\u66f4\u9ad8\u6548\u548c\u73b0\u4ee3\u7684\u4ee3\u7801\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u5b89\u5168\u6027<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u5b89\u5168\u6027\u662f\u4f7f\u7528\u6700\u65b0\u7248\u672c\u7684\u4e00\u4e2a\u5173\u952e\u7406\u7531\u3002\u65e7\u7248\u672c\u53ef\u80fd\u5305\u542b\u672a\u4fee\u590d\u7684\u6f0f\u6d1e\uff0c\u800c\u8fd9\u4e9b\u6f0f\u6d1e\u53ef\u80fd\u4f1a\u88ab\u6076\u610f\u5229\u7528\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u793e\u533a\u652f\u6301<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u6700\u65b0\u7248\u672c\u7684Python\u901a\u5e38\u4e5f\u5f97\u5230\u66f4\u5e7f\u6cdb\u7684\u793e\u533a\u652f\u6301\u3002\u8fd9\u610f\u5473\u7740\u5982\u679c\u4f60\u9047\u5230\u4efb\u4f55\u95ee\u9898\u6216\u9700\u8981\u5e2e\u52a9\uff0c\u66f4\u5bb9\u6613\u627e\u5230\u89e3\u51b3\u65b9\u6848\u6216\u83b7\u5f97\u5e2e\u52a9\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><h3>\u5982\u4f55\u66f4\u65b0Python<\/h3>\n<\/p>\n<p><p>\u5982\u679c\u53d1\u73b0\u5f53\u524d\u4f7f\u7528\u7684Python\u7248\u672c\u5df2\u8fc7\u671f\u6216\u4e0d\u518d\u652f\u6301\uff0c\u4f60\u9700\u8981\u66f4\u65b0\u5230\u6700\u65b0\u7248\u672c\u3002\u66f4\u65b0Python\u7684\u6b65\u9aa4\u53ef\u80fd\u56e0\u64cd\u4f5c\u7cfb\u7edf\u4e0d\u540c\u800c\u6709\u6240\u4e0d\u540c\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>Windows\u7cfb\u7edf<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u4e0b\u8f7d\u6700\u65b0\u7684Python\u5b89\u88c5\u7a0b\u5e8f\uff1a\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9\u7684\u201cDownloads\u201d\u9875\u9762\uff0c\u9009\u62e9\u9002\u5408Windows\u7684\u6700\u65b0\u7248\u672c\u3002<\/li>\n<li>\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\uff1a\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\uff0c\u5e76\u786e\u4fdd\u9009\u4e2d\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u4ee5\u4fbf\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8f7b\u677e\u8bbf\u95eePython\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>macOS\u7cfb\u7edf<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u4f7f\u7528Homebrew\u66f4\u65b0\uff1a\u5982\u679c\u4f7f\u7528Homebrew\u7ba1\u7406\u8f6f\u4ef6\u5305\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u66f4\u65b0Python\uff1a\n<pre><code class=\"language-bash\">brew update<\/p>\n<p>brew upgrade python<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u76f4\u63a5\u4e0b\u8f7d\u5b89\u88c5\u5305\uff1a\u6216\u8005\uff0c\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u9002\u7528\u4e8emacOS\u7684\u6700\u65b0\u5b89\u88c5\u5305\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>Linux\u7cfb\u7edf<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u66f4\u65b0\uff1a\u5728Linux\u7cfb\u7edf\u4e0a\uff0c\u901a\u5e38\u901a\u8fc7\u5305\u7ba1\u7406\u5668\uff08\u5982apt\u3001yum\u7b49\uff09\u8fdb\u884c\u66f4\u65b0\u3002\u4f8b\u5982\uff0c\u5728Ubuntu\u4e0a\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a\n<pre><code class=\"language-bash\">sudo apt update<\/p>\n<p>sudo apt install python3<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u6e90\u7801\u5b89\u88c5\uff1a\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u4ece\u6e90\u7801\u7f16\u8bd1\u5b89\u88c5\u6700\u65b0\u7684Python\u7248\u672c\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u8bf7\u786e\u4fdd\u4f60\u6709\u8db3\u591f\u7684\u7f16\u7a0b\u548c\u7cfb\u7edf\u7ba1\u7406\u7ecf\u9a8c\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><h3>\u517c\u5bb9\u6027\u6d4b\u8bd5<\/h3>\n<\/p>\n<p><p>\u5728\u66f4\u65b0Python\u7248\u672c\u540e\uff0c\u786e\u4fdd\u6240\u6709\u4f7f\u7528\u7684\u5e93\u548c\u5e94\u7528\u7a0b\u5e8f\u4e0e\u65b0\u7248\u672c\u517c\u5bb9\u662f\u975e\u5e38\u91cd\u8981\u7684\u3002\u66f4\u65b0\u53ef\u80fd\u5bfc\u81f4\u4e00\u4e9b\u4f9d\u8d56\u5e93\u4e0d\u518d\u517c\u5bb9\uff0c\u56e0\u6b64\u9700\u8981\u8fdb\u884c\u5168\u9762\u7684\u6d4b\u8bd5\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u521b\u5efa\u865a\u62df\u73af\u5883<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u4f7f\u7528Python\u7684<code>venv<\/code>\u6a21\u5757\u521b\u5efa\u4e00\u4e2a\u865a\u62df\u73af\u5883\uff0c\u4ee5\u9694\u79bb\u548c\u6d4b\u8bd5\u5e94\u7528\u7a0b\u5e8f\u3002<\/li>\n<li>\u8fd9\u6837\u53ef\u4ee5\u907f\u514d\u5bf9\u5168\u5c40\u73af\u5883\u7684\u5f71\u54cd\uff0c\u5e76\u4e14\u66f4\u5bb9\u6613\u7ba1\u7406\u4f9d\u8d56\u9879\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u6d4b\u8bd5\u5e94\u7528\u7a0b\u5e8f<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u5728\u865a\u62df\u73af\u5883\u4e2d\uff0c\u5b89\u88c5\u5e94\u7528\u7a0b\u5e8f\u6240\u9700\u7684\u6240\u6709\u5e93\u3002<\/li>\n<li>\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\u7684\u6d4b\u8bd5\u5957\u4ef6\uff0c\u786e\u4fdd\u6240\u6709\u529f\u80fd\u5728\u65b0\u7248\u672c\u7684Python\u4e0a\u6b63\u5e38\u5de5\u4f5c\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u66f4\u65b0\u4f9d\u8d56\u5e93<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u5982\u679c\u67d0\u4e9b\u5e93\u4e0d\u518d\u517c\u5bb9\uff0c\u5c1d\u8bd5\u66f4\u65b0\u5230\u5b83\u4eec\u7684\u6700\u65b0\u7248\u672c\u3002<\/li>\n<li>\u5982\u679c\u6ca1\u6709\u53ef\u7528\u7684\u66f4\u65b0\uff0c\u53ef\u80fd\u9700\u8981\u5bfb\u627e\u66ff\u4ee3\u5e93\u6216\u8fdb\u884c\u4ee3\u7801\u4fee\u6539\u4ee5\u786e\u4fdd\u517c\u5bb9\u6027\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><h3>\u5982\u4f55\u56de\u6edaPython\u7248\u672c<\/h3>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u66f4\u65b0\u53ef\u80fd\u5bfc\u81f4\u610f\u5916\u7684\u95ee\u9898\u6216\u4e0e\u73b0\u6709\u9879\u76ee\u7684\u4e0d\u517c\u5bb9\u3002\u8fd9\u65f6\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u56de\u6eda\u5230\u4e4b\u524d\u7684\u7248\u672c\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u56de\u6eda\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>Windows\u7cfb\u7edf<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u5378\u8f7d\u5f53\u524d\u7684Python\u7248\u672c\uff1a\u901a\u8fc7\u201c\u63a7\u5236\u9762\u677f\u201d\u4e2d\u7684\u201c\u7a0b\u5e8f\u548c\u529f\u80fd\u201d\u5378\u8f7d\u5f53\u524d\u7248\u672c\u3002<\/li>\n<li>\u91cd\u65b0\u5b89\u88c5\u65e7\u7248\u672c\uff1a\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9\u7684\u201cDownloads\u201d\u9875\u9762\uff0c\u5bfb\u627e\u65e7\u7248\u672c\u7684\u5b89\u88c5\u7a0b\u5e8f\u5e76\u91cd\u65b0\u5b89\u88c5\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>macOS\u7cfb\u7edf<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u4f7f\u7528Homebrew\u56de\u6eda\uff1a\u5982\u679c\u4e4b\u524d\u4f7f\u7528Homebrew\u5b89\u88c5\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u56de\u6eda\u7248\u672c\uff1a\n<pre><code class=\"language-bash\">brew switch python [\u65e7\u7248\u672c\u53f7]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u624b\u52a8\u5b89\u88c5\u65e7\u7248\u672c\uff1a\u4ecePython\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u65e7\u7248\u672c\u7684\u5b89\u88c5\u5305\u8fdb\u884c\u624b\u52a8\u5b89\u88c5\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>Linux\u7cfb\u7edf<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u56de\u6eda\uff1a\u5728\u67d0\u4e9bLinux\u53d1\u884c\u7248\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u5305\u7ba1\u7406\u5668\u56de\u6eda\u7248\u672c\u3002\u4f8b\u5982\uff0c\u5728Ubuntu\u4e0a\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff08\u5047\u8bbe\u6709\u65e7\u7248\u672c\u53ef\u7528\uff09\uff1a\n<pre><code class=\"language-bash\">sudo apt install python3=[\u65e7\u7248\u672c\u53f7]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u624b\u52a8\u7f16\u8bd1\u65e7\u7248\u672c\uff1a\u4e0b\u8f7d\u65e7\u7248\u672c\u7684\u6e90\u7801\u5e76\u8fdb\u884c\u7f16\u8bd1\u5b89\u88c5\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><h3>\u603b\u7ed3<\/h3>\n<\/p>\n<p><p><strong>\u4fdd\u6301Python\u7248\u672c\u7684\u66f4\u65b0\u662f\u786e\u4fdd\u7a0b\u5e8f\u5b89\u5168\u548c\u9ad8\u6548\u8fd0\u884c\u7684\u5173\u952e<\/strong>\u3002\u901a\u8fc7\u5b9a\u671f\u68c0\u67e5\u5f53\u524d\u5b89\u88c5\u7684\u7248\u672c\u3001\u5bf9\u6bd4\u6700\u65b0\u7248\u672c\u3001\u5173\u6ce8\u5b89\u5168\u516c\u544a\u548c\u652f\u6301\u5468\u671f\uff0c\u4f60\u53ef\u4ee5\u6709\u6548\u5730\u5224\u65adPython\u662f\u5426\u8fc7\u671f\u3002\u6b64\u5916\uff0c\u53ca\u65f6\u66f4\u65b0\u5230\u6700\u65b0\u7248\u672c\uff0c\u5e76\u8fdb\u884c\u517c\u5bb9\u6027\u6d4b\u8bd5\uff0c\u786e\u4fdd\u9879\u76ee\u7684\u5e73\u7a33\u8fc7\u6e21\u3002\u5982\u679c\u66f4\u65b0\u540e\u9047\u5230\u95ee\u9898\uff0c\u4e5f\u53ef\u4ee5\u8003\u8651\u56de\u6eda\u5230\u4e4b\u524d\u7684\u7248\u672c\u3002\u5728\u6574\u4e2a\u8fc7\u7a0b\u4e2d\uff0c\u4f7f\u7528\u865a\u62df\u73af\u5883\u548c\u7248\u672c\u63a7\u5236\u5de5\u5177\u53ef\u4ee5\u5927\u5927\u7b80\u5316\u7ba1\u7406\u548c\u6d4b\u8bd5\u7684\u590d\u6742\u6027\u3002\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u4f60\u53ef\u4ee5\u6709\u6548\u7ba1\u7406Python\u7248\u672c\uff0c\u4fdd\u8bc1\u9879\u76ee\u7684\u5b89\u5168\u6027\u548c\u7a33\u5b9a\u6027\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u68c0\u67e5\u6211\u5f53\u524d\u5b89\u88c5\u7684Python\u7248\u672c\uff1f<\/strong><br \/>\u8981\u67e5\u770b\u60a8\u5f53\u524d\u5b89\u88c5\u7684Python\u7248\u672c\uff0c\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u6216\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<code>python --version<\/code> \u6216 <code>python3 --version<\/code>\u3002\u8fd9\u5c06\u663e\u793a\u60a8\u7684Python\u7248\u672c\u53f7\uff0c\u4f8b\u5982\u201cPython 3.9.7\u201d\u3002\u786e\u4fdd\u60a8\u4f7f\u7528\u7684\u662f\u6b63\u786e\u7684\u547d\u4ee4\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u60a8\u7684\u64cd\u4f5c\u7cfb\u7edf\u548cPython\u7684\u5b89\u88c5\u65b9\u5f0f\u3002<\/p>\n<p><strong>\u5982\u4f55\u4e86\u89e3\u6211\u7684Python\u7248\u672c\u662f\u5426\u4ecd\u7136\u53d7\u5230\u652f\u6301\uff1f<\/strong><br \/>\u8981\u5224\u65ad\u60a8\u7684Python\u7248\u672c\u662f\u5426\u4ecd\u7136\u53d7\u5230\u652f\u6301\uff0c\u53ef\u4ee5\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9\u7684<a href=\"https:\/\/www.python.org\/doc\/sunset-python-2\/\">\u5b98\u65b9\u7248\u672c\u751f\u547d\u5468\u671f\u9875\u9762<\/a>\u3002\u8be5\u9875\u9762\u5217\u51fa\u4e86\u5404\u4e2a\u7248\u672c\u7684\u652f\u6301\u72b6\u6001\uff0c\u5305\u62ec\u5f53\u524d\u7684\u5b89\u5168\u66f4\u65b0\u548c\u7ef4\u62a4\u7248\u672c\u3002\u786e\u4fdd\u60a8\u4f7f\u7528\u7684\u7248\u672c\u5728\u652f\u6301\u8303\u56f4\u5185\uff0c\u4ee5\u907f\u514d\u5b89\u5168\u98ce\u9669\u548c\u529f\u80fd\u7f3a\u5931\u3002<\/p>\n<p><strong>\u5982\u679c\u6211\u7684Python\u7248\u672c\u5df2\u8fc7\u671f\uff0c\u6211\u8be5\u5982\u4f55\u5347\u7ea7\uff1f<\/strong><br \/>\u5982\u679c\u60a8\u53d1\u73b0\u81ea\u5df1\u7684Python\u7248\u672c\u5df2\u8fc7\u671f\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bbf\u95eePython\u5b98\u7f51\u4e0b\u8f7d\u5b89\u88c5\u6700\u65b0\u7248\u672c\u7684\u5b89\u88c5\u7a0b\u5e8f\u3002\u5728Windows\u548cmacOS\u4e0a\uff0c\u60a8\u53ef\u4ee5\u76f4\u63a5\u4e0b\u8f7d\u5e76\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\uff1b\u5728Linux\u4e0a\uff0c\u901a\u5e38\u53ef\u4ee5\u4f7f\u7528\u5305\u7ba1\u7406\u5668\uff08\u4f8b\u5982apt\u3001yum\u7b49\uff09\u6765\u5347\u7ea7Python\u3002\u786e\u4fdd\u5728\u5347\u7ea7\u540e\u68c0\u67e5\u60a8\u7684\u9879\u76ee\u548c\u4f9d\u8d56\u9879\u662f\u5426\u4e0e\u65b0\u7248\u672c\u517c\u5bb9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u67e5\u770bPython\u662f\u5426\u8fc7\u671f\uff0c\u53ef\u4ee5\u901a\u8fc7\u68c0\u67e5\u5f53\u524d\u5b89\u88c5\u7684Python\u7248\u672c\u3001\u5bf9\u6bd4\u5f53\u524d\u7248\u672c\u4e0e\u6700\u65b0\u7248\u672c\u3001\u5173\u6ce8\u5b89\u5168\u516c\u544a\u7b49\u65b9\u6cd5 [&hellip;]","protected":false},"author":3,"featured_media":1019280,"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\/1019257"}],"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=1019257"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1019257\/revisions"}],"predecessor-version":[{"id":1019281,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1019257\/revisions\/1019281"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1019280"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1019257"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1019257"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1019257"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}