{"id":983292,"date":"2024-12-27T07:18:11","date_gmt":"2024-12-26T23:18:11","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/983292.html"},"modified":"2024-12-27T07:18:13","modified_gmt":"2024-12-26T23:18:13","slug":"%e6%a0%91%e8%8e%93%e6%b4%be%e5%a6%82%e4%bd%95%e5%ae%89%e8%a3%85python","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/983292.html","title":{"rendered":"\u6811\u8393\u6d3e\u5982\u4f55\u5b89\u88c5python"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24211406\/2f584cfa-70b6-4348-b3b4-524792f399ef.webp\" alt=\"\u6811\u8393\u6d3e\u5982\u4f55\u5b89\u88c5python\" \/><\/p>\n<p><p> <strong>\u6811\u8393\u6d3e\u5b89\u88c5Python\u7684\u6b65\u9aa4\u5305\u62ec\uff1a\u68c0\u67e5\u7cfb\u7edf\u7248\u672c\u3001\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u5b89\u88c5\u3001\u8bbe\u7f6e\u865a\u62df\u73af\u5883\u3001\u9a8c\u8bc1\u5b89\u88c5\u6210\u529f\u3002<\/strong>\u5176\u4e2d\uff0c\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u5b89\u88c5\u662f\u5173\u952e\u6b65\u9aa4\uff0c\u8fd9\u4f7f\u5f97\u5b89\u88c5\u8fc7\u7a0b\u66f4\u52a0\u7b80\u4fbf\u548c\u7cfb\u7edf\u5316\u3002\u6811\u8393\u6d3e\u901a\u5e38\u8fd0\u884c\u57fa\u4e8eDebian\u7684Raspberry Pi OS\uff0c\u5b83\u81ea\u5e26\u4e86Python\uff0c\u4f46\u6709\u65f6\u9700\u8981\u5b89\u88c5\u7279\u5b9a\u7248\u672c\u6216\u914d\u7f6e\u73af\u5883\u3002\u901a\u8fc7\u5305\u7ba1\u7406\u5668\u5b89\u88c5\uff0c\u53ef\u4ee5\u786e\u4fdd\u83b7\u5f97\u6700\u65b0\u7684\u66f4\u65b0\u548c\u5b89\u5168\u8865\u4e01\uff0c\u4fdd\u8bc1Python\u7a0b\u5e8f\u7684\u7a33\u5b9a\u6027\u548c\u5b89\u5168\u6027\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u68c0\u67e5\u7cfb\u7edf\u7248\u672c<\/p>\n<\/p>\n<p><p>\u5728\u5b89\u88c5Python\u4e4b\u524d\uff0c\u9996\u5148\u9700\u8981\u4e86\u89e3\u5f53\u524d\u6811\u8393\u6d3e\u7684\u64cd\u4f5c\u7cfb\u7edf\u7248\u672c\u3002\u6811\u8393\u6d3e\u901a\u5e38\u4f7f\u7528Raspberry Pi OS\uff0c\u8fd9\u662f\u4e00\u79cd\u57fa\u4e8eDebian\u7684\u64cd\u4f5c\u7cfb\u7edf\u3002\u8981\u68c0\u67e5\u5f53\u524d\u7cfb\u7edf\u7248\u672c\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">cat \/etc\/os-release<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u547d\u4ee4\u5c06\u663e\u793a\u64cd\u4f5c\u7cfb\u7edf\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u5305\u62ec\u540d\u79f0\u3001\u7248\u672c\u53f7\u7b49\u3002\u4e86\u89e3\u8fd9\u4e9b\u4fe1\u606f\u6709\u52a9\u4e8e\u9009\u62e9\u5408\u9002\u7684Python\u7248\u672c\u548c\u5b89\u88c5\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><p>\u4e8c\u3001\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u5b89\u88c5Python<\/p>\n<\/p>\n<p><p>\u6811\u8393\u6d3e\u7684Raspberry Pi OS\u9ed8\u8ba4\u5df2\u7ecf\u5b89\u88c5\u4e86Python\uff0c\u4f46\u7248\u672c\u53ef\u80fd\u4e0d\u662f\u6700\u65b0\u7684\u3002\u5982\u679c\u9700\u8981\u5b89\u88c5\u7279\u5b9a\u7248\u672c\u7684Python\uff0c\u53ef\u4ee5\u4f7f\u7528apt\u5305\u7ba1\u7406\u5668\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u66f4\u65b0\u5305\u7ba1\u7406\u5668<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u5b89\u88c5\u65b0\u8f6f\u4ef6\u4e4b\u524d\uff0c\u5efa\u8bae\u66f4\u65b0\u5305\u7ba1\u7406\u5668\u4ee5\u786e\u4fdd\u83b7\u53d6\u6700\u65b0\u7684\u8f6f\u4ef6\u5305\u5217\u8868\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt update<\/p>\n<p>sudo apt upgrade<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5Python<\/strong><\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5Python 3\u7684\u6700\u65b0\u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt install python3<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u9700\u8981\u7279\u5b9a\u7248\u672c\uff0c\u53ef\u4ee5\u6307\u5b9a\u7248\u672c\u53f7\uff0c\u4f8b\u5982Python 3.9\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt install python3.9<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001\u8bbe\u7f6e\u865a\u62df\u73af\u5883<\/p>\n<\/p>\n<p><p>\u5728\u6811\u8393\u6d3e\u4e0a\u5f00\u53d1Python\u9879\u76ee\u65f6\uff0c\u4f7f\u7528\u865a\u62df\u73af\u5883\u53ef\u4ee5\u9694\u79bb\u9879\u76ee\u4f9d\u8d56\uff0c\u907f\u514d\u4e0d\u540c\u9879\u76ee\u4e4b\u95f4\u7684\u51b2\u7a81\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5b89\u88c5virtualenv<\/strong><\/p>\n<\/p>\n<p><p>\u9996\u5148\u5b89\u88c5virtualenv\u5de5\u5177\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt install python3-venv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u521b\u5efa\u865a\u62df\u73af\u5883<\/strong><\/p>\n<\/p>\n<p><p>\u8fdb\u5165\u9879\u76ee\u76ee\u5f55\uff0c\u521b\u5efa\u865a\u62df\u73af\u5883\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python3 -m venv myprojectenv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u91cc\u7684<code>myprojectenv<\/code>\u662f\u865a\u62df\u73af\u5883\u7684\u540d\u79f0\uff0c\u53ef\u4ee5\u6839\u636e\u9879\u76ee\u9700\u6c42\u81ea\u5b9a\u4e49\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6fc0\u6d3b\u865a\u62df\u73af\u5883<\/strong><\/p>\n<\/p>\n<p><p>\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u540e\uff0c\u6240\u6709\u5b89\u88c5\u7684\u5305\u548c\u6267\u884c\u7684Python\u4ee3\u7801\u90fd\u5c06\u5728\u8be5\u73af\u5883\u4e2d\u8fd0\u884c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">source myprojectenv\/bin\/activate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u56db\u3001\u9a8c\u8bc1\u5b89\u88c5\u6210\u529f<\/p>\n<\/p>\n<p><p>\u6700\u540e\uff0c\u9a8c\u8bc1Python\u662f\u5426\u6b63\u786e\u5b89\u88c5\u4ee5\u53ca\u7248\u672c\u662f\u5426\u7b26\u5408\u9884\u671f\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u68c0\u67e5Python\u7248\u672c<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770bPython\u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python3 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u663e\u793a\u5f53\u524d\u5b89\u88c5\u7684Python 3\u7248\u672c\u53f7\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u9a8c\u8bc1pip\u5b89\u88c5<\/strong><\/p>\n<\/p>\n<p><p>pip\u662fPython\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u901a\u5e38\u4e0ePython\u4e00\u8d77\u5b89\u88c5\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u68c0\u67e5pip\u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip3 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u663e\u793apip\u7684\u7248\u672c\u53f7\uff0c\u786e\u4fddpip\u5df2\u6b63\u786e\u5b89\u88c5\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e94\u3001\u5b89\u88c5\u5e38\u7528Python\u5e93<\/p>\n<\/p>\n<p><p>\u5728\u6811\u8393\u6d3e\u4e0a\u5b89\u88c5Python\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528pip\u5b89\u88c5\u5e38\u7528\u7684Python\u5e93\uff0c\u5982numpy\u3001pandas\u7b49\u3002\u8fd9\u4e9b\u5e93\u5bf9\u4e8e\u79d1\u5b66\u8ba1\u7b97\u548c\u6570\u636e\u5904\u7406\u975e\u5e38\u6709\u7528\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5b89\u88c5numpy<\/strong><\/p>\n<\/p>\n<p><p>numpy\u662f\u4e00\u4e2a\u7528\u4e8e\u79d1\u5b66\u8ba1\u7b97\u7684\u5e93\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip3 install numpy<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5pandas<\/strong><\/p>\n<\/p>\n<p><p>pandas\u662f\u4e00\u4e2a\u7528\u4e8e\u6570\u636e\u5206\u6790\u7684\u5e93\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip3 install pandas<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u516d\u3001\u914d\u7f6ePython\u5f00\u53d1\u73af\u5883<\/p>\n<\/p>\n<p><p>\u4e3a\u4e86\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\uff0c\u53ef\u4ee5\u5728\u6811\u8393\u6d3e\u4e0a\u914d\u7f6e\u4e00\u4e2a\u5408\u9002\u7684Python\u5f00\u53d1\u73af\u5883\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u9009\u62e9\u5408\u9002\u7684\u7f16\u8f91\u5668<\/strong><\/p>\n<\/p>\n<p><p>\u6811\u8393\u6d3e\u4e0a\u53ef\u7528\u7684\u7f16\u8f91\u5668\u6709\u5f88\u591a\uff0c\u5982nano\u3001vim\u3001Visual Studio Code\u7b49\u3002\u5bf9\u4e8e\u521d\u5b66\u8005\uff0c\u5efa\u8bae\u4f7f\u7528Visual Studio Code\uff0c\u5b83\u63d0\u4f9b\u4e86\u826f\u597d\u7684\u7528\u6237\u754c\u9762\u548c\u4e30\u5bcc\u7684\u63d2\u4ef6\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5Visual Studio Code<\/strong><\/p>\n<\/p>\n<p><p>\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5Visual Studio Code\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt install code<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u914d\u7f6ePython\u63d2\u4ef6<\/strong><\/p>\n<\/p>\n<p><p>\u5728Visual Studio Code\u4e2d\uff0c\u5b89\u88c5Python\u63d2\u4ef6\u4ee5\u83b7\u5f97\u8bed\u6cd5\u9ad8\u4eae\u3001\u4ee3\u7801\u8865\u5168\u7b49\u529f\u80fd\u3002\u8fd9\u6709\u52a9\u4e8e\u63d0\u9ad8\u4ee3\u7801\u7f16\u5199\u548c\u8c03\u8bd5\u7684\u6548\u7387\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e03\u3001\u5904\u7406\u6811\u8393\u6d3e\u7684\u6027\u80fd\u9650\u5236<\/p>\n<\/p>\n<p><p>\u6811\u8393\u6d3e\u7684\u786c\u4ef6\u6027\u80fd\u6709\u9650\uff0c\u5728\u8fd0\u884c\u5927\u578bPython\u7a0b\u5e8f\u65f6\u53ef\u80fd\u4f1a\u9047\u5230\u6027\u80fd\u74f6\u9888\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u4f18\u5316\u5efa\u8bae\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4f18\u5316\u4ee3\u7801<\/strong><\/p>\n<\/p>\n<p><p>\u7f16\u5199\u9ad8\u6548\u7684\u4ee3\u7801\u53ef\u4ee5\u51cf\u5c11\u8ba1\u7b97\u65f6\u95f4\u548c\u8d44\u6e90\u6d88\u8017\u3002\u907f\u514d\u4e0d\u5fc5\u8981\u7684\u5faa\u73af\uff0c\u4f7f\u7528\u9ad8\u6548\u7684\u6570\u636e\u7ed3\u6784\u7b49\u90fd\u662f\u5e38\u89c1\u7684\u4f18\u5316\u6280\u5de7\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528\u8f7b\u91cf\u7ea7\u5e93<\/strong><\/p>\n<\/p>\n<p><p>\u5c3d\u91cf\u9009\u62e9\u8f7b\u91cf\u7ea7\u7684\u5e93\u548c\u5de5\u5177\uff0c\u4ee5\u51cf\u5c11\u7cfb\u7edf\u8d44\u6e90\u7684\u5360\u7528\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u9009\u62e9\u8f7b\u91cf\u7ea7\u7684web\u6846\u67b6\u6765\u66ff\u4ee3Django\u7b49\u91cd\u91cf\u7ea7\u6846\u67b6\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6269\u5c55\u5b58\u50a8<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528\u5916\u90e8\u5b58\u50a8\u8bbe\u5907\uff08\u5982USB\u786c\u76d8\uff09\u53ef\u4ee5\u6269\u5c55\u6811\u8393\u6d3e\u7684\u5b58\u50a8\u7a7a\u95f4\uff0c\u4ece\u800c\u5bb9\u7eb3\u66f4\u591a\u7684\u6570\u636e\u548c\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u516b\u3001\u4f7f\u7528\u6811\u8393\u6d3e\u8fdb\u884cPython\u9879\u76ee\u5f00\u53d1<\/p>\n<\/p>\n<p><p>\u6811\u8393\u6d3e\u662f\u4e00\u4e2a\u975e\u5e38\u597d\u7684Python\u9879\u76ee\u5f00\u53d1\u5e73\u53f0\uff0c\u7279\u522b\u9002\u7528\u4e8e\u7269\u8054\u7f51\u3001\u673a\u5668\u4eba\u7b49\u9886\u57df\u7684\u9879\u76ee\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u7269\u8054\u7f51\u9879\u76ee<\/strong><\/p>\n<\/p>\n<p><p>\u6811\u8393\u6d3e\u53ef\u4ee5\u901a\u8fc7GPIO\u63a5\u53e3\u8fde\u63a5\u5404\u79cd\u4f20\u611f\u5668\u548c\u8bbe\u5907\uff0c\u662f\u7269\u8054\u7f51\u9879\u76ee\u7684\u7406\u60f3\u5e73\u53f0\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u4f7f\u7528Python\u7f16\u5199\u4ee3\u7801\uff0c\u8bfb\u53d6\u6e29\u5ea6\u4f20\u611f\u5668\u7684\u6570\u636e\uff0c\u5e76\u901a\u8fc7\u7f51\u7edc\u5c06\u5176\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u673a\u5668\u4eba\u9879\u76ee<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528\u6811\u8393\u6d3e\u63a7\u5236\u7535\u673a\u548c\u4f20\u611f\u5668\uff0c\u53ef\u4ee5\u6784\u5efa\u7b80\u5355\u7684\u673a\u5668\u4eba\u9879\u76ee\u3002Python\u6709\u4e30\u5bcc\u7684\u5e93\u652f\u6301\u673a\u5668\u4eba\u5f00\u53d1\uff0c\u5982RPi.GPIO\u3001pigpio\u7b49\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u591a\u5a92\u4f53\u9879\u76ee<\/strong><\/p>\n<\/p>\n<p><p>\u6811\u8393\u6d3e\u652f\u6301\u97f3\u9891\u548c\u89c6\u9891\u64ad\u653e\uff0c\u53ef\u4ee5\u7528\u4e8e\u591a\u5a92\u4f53\u9879\u76ee\u5f00\u53d1\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u4f7f\u7528Python\u7f16\u5199\u811a\u672c\uff0c\u63a7\u5236\u89c6\u9891\u7684\u64ad\u653e\u548c\u505c\u6b62\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e5d\u3001\u6811\u8393\u6d3e\u7684Python\u5e94\u7528\u6848\u4f8b<\/p>\n<\/p>\n<p><p>\u4e3a\u4e86\u66f4\u597d\u5730\u7406\u89e3\u5982\u4f55\u5728\u6811\u8393\u6d3e\u4e0a\u4f7f\u7528Python\uff0c\u53ef\u4ee5\u53c2\u8003\u4ee5\u4e0b\u5e94\u7528\u6848\u4f8b\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5bb6\u5ead\u81ea\u52a8\u5316\u7cfb\u7edf<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528\u6811\u8393\u6d3e\u548cPython\u53ef\u4ee5\u642d\u5efa\u4e00\u4e2a\u7b80\u5355\u7684\u5bb6\u5ead\u81ea\u52a8\u5316\u7cfb\u7edf\u3002\u901a\u8fc7Python\u811a\u672c\u63a7\u5236\u706f\u5149\u3001\u6e29\u5ea6\u7b49\u8bbe\u5907\uff0c\u5b9e\u73b0\u667a\u80fd\u5bb6\u5c45\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6570\u636e\u91c7\u96c6\u7cfb\u7edf<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u6811\u8393\u6d3e\u4e0a\u8fd0\u884cPython\u7a0b\u5e8f\uff0c\u5b9a\u671f\u91c7\u96c6\u73af\u5883\u4f20\u611f\u5668\u7684\u6570\u636e\uff0c\u5e76\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\uff0c\u4ee5\u4fbf\u540e\u7eed\u5206\u6790\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7f51\u7edc\u670d\u52a1\u5668<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528Python\u7684Flask\u6216Django\u6846\u67b6\uff0c\u53ef\u4ee5\u5728\u6811\u8393\u6d3e\u4e0a\u642d\u5efa\u4e00\u4e2a\u7b80\u5355\u7684\u7f51\u7edc\u670d\u52a1\u5668\uff0c\u7528\u4e8e\u5904\u7406\u5ba2\u6237\u7aef\u8bf7\u6c42\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u5341\u3001\u603b\u7ed3<\/p>\n<\/p>\n<p><p>\u5728\u6811\u8393\u6d3e\u4e0a\u5b89\u88c5\u548c\u914d\u7f6ePython\u662f\u4e00\u4e2a\u76f8\u5bf9\u7b80\u5355\u7684\u8fc7\u7a0b\uff0c\u4f46\u9700\u8981\u6ce8\u610f\u4e00\u4e9b\u7ec6\u8282\u4ee5\u786e\u4fdd\u5b89\u88c5\u7684\u6210\u529f\u548c\u7cfb\u7edf\u7684\u7a33\u5b9a\u3002\u901a\u8fc7\u5408\u7406\u914d\u7f6e\u548c\u4f18\u5316\uff0c\u53ef\u4ee5\u5145\u5206\u53d1\u6325\u6811\u8393\u6d3e\u7684\u6f5c\u529b\uff0c\u5f00\u53d1\u51fa\u4e30\u5bcc\u7684\u5e94\u7528\u7a0b\u5e8f\u3002\u65e0\u8bba\u662f\u7269\u8054\u7f51\u3001\u673a\u5668\u4eba\u8fd8\u662f\u591a\u5a92\u4f53\u9879\u76ee\uff0cPython\u90fd\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u652f\u6301\uff0c\u4f7f\u5f97\u6811\u8393\u6d3e\u6210\u4e3a\u4e00\u4e2a\u975e\u5e38\u7075\u6d3b\u548c\u5f3a\u5927\u7684\u5f00\u53d1\u5e73\u53f0\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728\u6811\u8393\u6d3e\u4e0a\u5b89\u88c5Python\u7684\u4e0d\u540c\u7248\u672c\uff1f<\/strong><br \/>\u5728\u6811\u8393\u6d3e\u4e0a\u5b89\u88c5Python\u53ef\u4ee5\u901a\u8fc7\u5b98\u65b9\u7684\u5305\u7ba1\u7406\u5de5\u5177\u6765\u5b8c\u6210\u3002\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4 <code>sudo apt update<\/code> \u66f4\u65b0\u8f6f\u4ef6\u6e90\uff0c\u7136\u540e\u4f7f\u7528 <code>sudo apt install python3<\/code> \u5b89\u88c5Python 3\u3002\u82e5\u9700\u8981\u5b89\u88c5Python 2\uff0c\u53ef\u4ee5\u4f7f\u7528 <code>sudo apt install python<\/code>\u3002\u5982\u679c\u5e0c\u671b\u5b89\u88c5\u7279\u5b9a\u7248\u672c\u7684Python\uff0c\u53ef\u4ee5\u8bbf\u95eePython\u7684\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u6e90\u4ee3\u7801\u8fdb\u884c\u7f16\u8bd1\uff0c\u6216\u8005\u4f7f\u7528pyenv\u7b49\u5de5\u5177\u6765\u7ba1\u7406\u591a\u4e2aPython\u7248\u672c\u3002<\/p>\n<p><strong>\u6811\u8393\u6d3e\u4e0a\u5b89\u88c5Python\u540e\u5982\u4f55\u9a8c\u8bc1\u5b89\u88c5\u662f\u5426\u6210\u529f\uff1f<\/strong><br \/>\u9a8c\u8bc1Python\u662f\u5426\u6210\u529f\u5b89\u88c5\u975e\u5e38\u7b80\u5355\u3002\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165 <code>python3 --version<\/code> \u6216 <code>python --version<\/code>\uff0c\u5982\u679c\u5b89\u88c5\u6210\u529f\uff0c\u7cfb\u7edf\u4f1a\u663e\u793a\u5df2\u5b89\u88c5\u7684Python\u7248\u672c\u4fe1\u606f\u3002\u6b64\u5916\uff0c\u53ef\u4ee5\u901a\u8fc7\u542f\u52a8Python\u4ea4\u4e92\u5f0f\u73af\u5883\uff0c\u8f93\u5165 <code>python3<\/code> \u6216 <code>python<\/code>\uff0c\u5982\u679c\u6210\u529f\u8fdb\u5165Python\u63d0\u793a\u7b26\uff0c\u8bf4\u660e\u5b89\u88c5\u65e0\u8bef\u3002<\/p>\n<p><strong>\u5728\u6811\u8393\u6d3e\u4e0a\u5b89\u88c5Python\u540e\uff0c\u5982\u4f55\u5b89\u88c5\u7b2c\u4e09\u65b9\u5e93\uff1f<\/strong><br \/>\u5b89\u88c5Python\u540e\uff0c\u4f7f\u7528pip\u5de5\u5177\u53ef\u4ee5\u8f7b\u677e\u5b89\u88c5\u7b2c\u4e09\u65b9\u5e93\u3002\u9996\u5148\u786e\u4fddpip\u5df2\u5b89\u88c5\uff0c\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4 <code>sudo apt install python3-pip<\/code> \u5b89\u88c5pip\u3002\u63a5\u4e0b\u6765\uff0c\u4f7f\u7528 <code>pip3 install \u5305\u540d<\/code> \u6765\u5b89\u88c5\u6240\u9700\u7684\u5e93\uff0c\u4f8b\u5982 <code>pip3 install numpy<\/code>\u3002\u53ef\u4ee5\u901a\u8fc7 <code>pip3 list<\/code> \u67e5\u770b\u5df2\u5b89\u88c5\u7684\u5e93\u548c\u7248\u672c\u4fe1\u606f\uff0c\u786e\u4fdd\u6240\u9700\u5e93\u6b63\u786e\u5b89\u88c5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u6811\u8393\u6d3e\u5b89\u88c5Python\u7684\u6b65\u9aa4\u5305\u62ec\uff1a\u68c0\u67e5\u7cfb\u7edf\u7248\u672c\u3001\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u5b89\u88c5\u3001\u8bbe\u7f6e\u865a\u62df\u73af\u5883\u3001\u9a8c\u8bc1\u5b89\u88c5\u6210\u529f\u3002\u5176\u4e2d\uff0c\u4f7f\u7528\u5305\u7ba1\u7406 [&hellip;]","protected":false},"author":3,"featured_media":983299,"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\/983292"}],"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=983292"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/983292\/revisions"}],"predecessor-version":[{"id":983302,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/983292\/revisions\/983302"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/983299"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=983292"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=983292"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=983292"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}