{"id":1188071,"date":"2025-01-15T20:12:50","date_gmt":"2025-01-15T12:12:50","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1188071.html"},"modified":"2025-01-15T20:12:54","modified_gmt":"2025-01-15T12:12:54","slug":"python%e5%a6%82%e4%bd%95%e5%ae%89%e8%a3%85%e5%9c%a8%e5%b9%b3%e6%9d%bf%e4%b8%8a","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1188071.html","title":{"rendered":"python\u5982\u4f55\u5b89\u88c5\u5728\u5e73\u677f\u4e0a"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25140509\/842b1b59-c85c-4d40-9d5a-2f2225c2de3d.webp\" alt=\"python\u5982\u4f55\u5b89\u88c5\u5728\u5e73\u677f\u4e0a\" \/><\/p>\n<p><p> \u5728\u5e73\u677f\u4e0a\u5b89\u88c5Python\uff0c\u53ef\u4ee5\u901a\u8fc7<strong>\u4f7f\u7528Python\u5e94\u7528\u5546\u5e97\u3001\u901a\u8fc7Termux\u3001\u5b89\u88c5Pydroid\u5e94\u7528<\/strong>\u7b49\u65b9\u5f0f\u8fdb\u884c\u3002\u4ee5\u4e0b\u5c06\u8be6\u7ec6\u63cf\u8ff0\u5176\u4e2d\u7684\u4e00\u4e2a\u65b9\u5f0f\uff0c\u5373\u901a\u8fc7Termux\u5b89\u88c5Python\u3002<strong>Termux<\/strong> \u662f\u4e00\u4e2aAndroid\u7ec8\u7aef\u4eff\u771f\u5668\uff0c\u63d0\u4f9b\u4e86\u4e00\u4e2aLinux\u73af\u5883\uff0c\u53ef\u4ee5\u901a\u8fc7\u5b83\u5728Android\u5e73\u677f\u4e0a\u8fd0\u884cPython\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528Termux\u5b89\u88c5Python<\/h3>\n<\/p>\n<p><p><strong>1\u3001\u5b89\u88c5Termux<\/strong><\/p>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u9700\u8981\u5728Android\u5e73\u677f\u4e0a\u5b89\u88c5Termux\u5e94\u7528\u3002\u53ef\u4ee5\u901a\u8fc7Google Play Store\u6216\u8005\u5176\u4ed6\u5e94\u7528\u5e02\u573a\u641c\u7d22\u201cTermux\u201d\u5e76\u5b89\u88c5\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6253\u5f00Termux\u5e94\u7528\u3002<\/p>\n<\/p>\n<p><p><strong>2\u3001\u66f4\u65b0\u8f6f\u4ef6\u5305\u548c\u5b89\u88c5Python<\/strong><\/p>\n<\/p>\n<p><p>\u6253\u5f00Termux\u540e\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u66f4\u65b0\u8f6f\u4ef6\u5305\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">pkg update<\/p>\n<p>pkg upgrade<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u63a5\u4e0b\u6765\uff0c\u5b89\u88c5Python\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">pkg install python<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e9b\u547d\u4ee4\u5c06\u4f1a\u4e0b\u8f7d\u5e76\u5b89\u88c5Python\u5230\u4f60\u7684Termux\u73af\u5883\u4e2d\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u9a8c\u8bc1Python\u662f\u5426\u5b89\u88c5\u6210\u529f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">python --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e8c\u3001\u4f7f\u7528Python\u5e94\u7528\u5546\u5e97<\/h3>\n<\/p>\n<p><p><strong>1\u3001\u5b89\u88c5Python\u5e94\u7528<\/strong><\/p>\n<\/p>\n<p><p>\u53ef\u4ee5\u901a\u8fc7\u5e73\u677f\u7684\u5e94\u7528\u5546\u5e97\uff08\u4f8b\u5982Google Play Store\u3001Apple App Store\u7b49\uff09\u641c\u7d22\u5e76\u5b89\u88c5Python\u76f8\u5173\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u4f8b\u5982\u201cPydroid 3\u201d\u3001\u201cQPython\u201d\u3001\u201cPyto\u201d\u7b49\u3002\u8fd9\u4e9b\u5e94\u7528\u7a0b\u5e8f\u901a\u5e38\u63d0\u4f9b\u4e86\u4e00\u4e2aPython\u7f16\u7a0b\u73af\u5883\uff0c\u652f\u6301\u7f16\u5199\u3001\u8fd0\u884c\u548c\u8c03\u8bd5Python\u4ee3\u7801\u3002<\/p>\n<\/p>\n<p><p><strong>2\u3001\u4f7f\u7528Python\u5e94\u7528\u7f16\u7a0b<\/strong><\/p>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6253\u5f00Python\u5e94\u7528\uff0c\u53ef\u4ee5\u5728\u5e94\u7528\u4e2d\u7f16\u5199Python\u4ee3\u7801\uff0c\u5e76\u8fd0\u884c\u548c\u8c03\u8bd5\u3002\u4e0d\u540c\u7684\u5e94\u7528\u6709\u4e0d\u540c\u7684\u754c\u9762\u548c\u529f\u80fd\uff0c\u4f46\u57fa\u672c\u64cd\u4f5c\u90fd\u662f\u7c7b\u4f3c\u7684\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u5b89\u88c5Pydroid\u5e94\u7528<\/h3>\n<\/p>\n<p><p><strong>1\u3001\u5b89\u88c5Pydroid 3<\/strong><\/p>\n<\/p>\n<p><p>Pydroid 3 \u662f\u4e00\u4e2a\u975e\u5e38\u6d41\u884c\u7684Python IDE\uff0c\u53ef\u4ee5\u5728Android\u8bbe\u5907\u4e0a\u8fd0\u884c\u3002\u53ef\u4ee5\u901a\u8fc7Google Play Store\u641c\u7d22\u201cPydroid 3\u201d\u5e76\u5b89\u88c5\u3002<\/p>\n<\/p>\n<p><p><strong>2\u3001\u4f7f\u7528Pydroid 3<\/strong><\/p>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6253\u5f00Pydroid 3\u3002\u4f60\u4f1a\u770b\u5230\u4e00\u4e2aPython\u7f16\u7a0b\u73af\u5883\uff0c\u53ef\u4ee5\u5728\u5176\u4e2d\u7f16\u5199\u3001\u8fd0\u884c\u548c\u8c03\u8bd5Python\u4ee3\u7801\u3002Pydroid 3 \u63d0\u4f9b\u4e86\u4e00\u4e2a\u5b8c\u6574\u7684Python\u5f00\u53d1\u73af\u5883\uff0c\u5305\u62ecPython\u89e3\u91ca\u5668\u3001\u4ee3\u7801\u7f16\u8f91\u5668\u3001\u5e93\u7ba1\u7406\u7b49\u529f\u80fd\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u8be6\u7ec6\u63cf\u8ff0Termux\u5b89\u88c5Python\u7684\u6b65\u9aa4<\/h3>\n<\/p>\n<p><p><strong>1\u3001\u5b89\u88c5Termux<\/strong><\/p>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u5728\u4f60\u7684Android\u5e73\u677f\u4e0a\u6253\u5f00Google Play Store\uff0c\u641c\u7d22\u201cTermux\u201d\u5e76\u5b89\u88c5\u3002Termux \u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u7ec8\u7aef\u6a21\u62df\u5668\uff0c\u5141\u8bb8\u4f60\u5728Android\u8bbe\u5907\u4e0a\u8fd0\u884cLinux\u73af\u5883\u3002<\/p>\n<\/p>\n<p><p><strong>2\u3001\u66f4\u65b0Termux\u8f6f\u4ef6\u5305<\/strong><\/p>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6253\u5f00Termux\u3002\u4e3a\u4e86\u786e\u4fdd\u4f60\u62e5\u6709\u6700\u65b0\u7684\u8f6f\u4ef6\u5305\u548c\u4fee\u590d\u4e86\u7684\u6f0f\u6d1e\uff0c\u9700\u8981\u66f4\u65b0Termux\u7684\u8f6f\u4ef6\u5305\u3002\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">pkg update<\/p>\n<p>pkg upgrade<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e9b\u547d\u4ee4\u4f1a\u66f4\u65b0Termux\u4e2d\u7684\u6240\u6709\u8f6f\u4ef6\u5305\uff0c\u5e76\u786e\u4fdd\u4f60\u62e5\u6709\u6700\u65b0\u7684\u7248\u672c\u3002<\/p>\n<\/p>\n<p><p><strong>3\u3001\u5b89\u88c5Python<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u66f4\u65b0\u4e86Termux\u7684\u8f6f\u4ef6\u5305\u540e\uff0c\u53ef\u4ee5\u5f00\u59cb\u5b89\u88c5Python\u3002\u5728Termux\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">pkg install python<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6b64\u547d\u4ee4\u5c06\u4f1a\u4e0b\u8f7d\u5e76\u5b89\u88c5Python\u5230\u4f60\u7684Termux\u73af\u5883\u4e2d\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u9a8c\u8bc1Python\u662f\u5426\u5b89\u88c5\u6210\u529f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">python --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u770b\u5230Python\u7684\u7248\u672c\u53f7\uff0c\u8bf4\u660ePython\u5df2\u7ecf\u6210\u529f\u5b89\u88c5\u3002<\/p>\n<\/p>\n<p><p><strong>4\u3001\u5b89\u88c5\u5176\u4ed6Python\u5305<\/strong><\/p>\n<\/p>\n<p><p>\u5728Termux\u4e2d\u5b89\u88c5Python\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7pip\u5b89\u88c5\u5176\u4ed6Python\u5305\u3002\u4f8b\u5982\uff0c\u5b89\u88c5requests\u5e93\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">pip install requests<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e94\u3001Python\u5728\u5e73\u677f\u4e0a\u7684\u5e94\u7528<\/h3>\n<\/p>\n<p><p><strong>1\u3001\u7f16\u5199Python\u811a\u672c<\/strong><\/p>\n<\/p>\n<p><p>\u5728Termux\u4e2d\u5b89\u88c5Python\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528\u4efb\u4f55\u6587\u672c\u7f16\u8f91\u5668\uff08\u4f8b\u5982nano\u3001vim\u7b49\uff09\u7f16\u5199Python\u811a\u672c\u3002\u4f8b\u5982\uff0c\u521b\u5efa\u5e76\u7f16\u8f91\u4e00\u4e2a\u540d\u4e3ahello.py\u7684\u6587\u4ef6\uff0c\u8f93\u5165\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">print(&quot;Hello, World!&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4fdd\u5b58\u5e76\u9000\u51fa\u7f16\u8f91\u5668\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u8fd0\u884c\u8be5Python\u811a\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">python hello.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>2\u3001\u5f00\u53d1\u548c\u8fd0\u884cPython\u5e94\u7528<\/strong><\/p>\n<\/p>\n<p><p>\u901a\u8fc7Termux\uff0c\u4f60\u53ef\u4ee5\u5728Android\u5e73\u677f\u4e0a\u5f00\u53d1\u548c\u8fd0\u884c\u5b8c\u6574\u7684Python\u5e94\u7528\u7a0b\u5e8f\u3002\u53ef\u4ee5\u4f7f\u7528\u4efb\u4f55\u4f60\u719f\u6089\u7684Python\u5e93\u548c\u6846\u67b6\uff0c\u4f8b\u5982Flask\u3001Django\u7b49\uff0c\u6765\u5f00\u53d1Web\u5e94\u7528\u3001\u6570\u636e\u5206\u6790\u811a\u672c\u3001\u81ea\u52a8\u5316\u5de5\u5177\u7b49\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u5728\u5e73\u677f\u4e0a\u5b89\u88c5\u548c\u8fd0\u884cPython\uff0c\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\u5b9e\u73b0\uff0c\u5305\u62ec\u4f7f\u7528Python\u5e94\u7528\u5546\u5e97\u3001\u901a\u8fc7Termux\u3001\u5b89\u88c5Pydroid\u5e94\u7528\u7b49\u3002\u901a\u8fc7Termux\u5b89\u88c5Python\u662f\u4e00\u79cd\u975e\u5e38\u7075\u6d3b\u548c\u5f3a\u5927\u7684\u65b9\u5f0f\uff0c\u5141\u8bb8\u4f60\u5728Android\u8bbe\u5907\u4e0a\u8fd0\u884c\u5b8c\u6574\u7684Linux\u73af\u5883\uff0c\u5e76\u4f7f\u7528\u6240\u6709\u719f\u6089\u7684\u547d\u4ee4\u884c\u5de5\u5177\u548cPython\u5e93\u3002\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u9700\u6c42\u548c\u4e60\u60ef\u9009\u62e9\u5408\u9002\u7684\u65b9\u5f0f\u6765\u5b89\u88c5\u548c\u4f7f\u7528Python\u3002\u5728\u5e73\u677f\u4e0a\u5b89\u88c5Python\u540e\uff0c\u53ef\u4ee5\u7f16\u5199\u3001\u8fd0\u884c\u548c\u8c03\u8bd5Python\u4ee3\u7801\uff0c\u5f00\u53d1\u5404\u79cd\u5e94\u7528\u7a0b\u5e8f\u548c\u811a\u672c\uff0c\u63d0\u9ad8\u5de5\u4f5c\u6548\u7387\u548c\u7f16\u7a0b\u4f53\u9a8c\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5728\u5e73\u677f\u4e0a\u5b89\u88c5Python\u7684\u6b65\u9aa4\u662f\u4ec0\u4e48\uff1f<\/strong><br \/>\u8981\u5728\u5e73\u677f\u4e0a\u5b89\u88c5Python\uff0c\u9996\u5148\u9700\u8981\u786e\u5b9a\u60a8\u7684\u5e73\u677f\u64cd\u4f5c\u7cfb\u7edf\u3002\u5bf9\u4e8eAndroid\u8bbe\u5907\uff0c\u53ef\u4ee5\u901a\u8fc7Google Play\u5546\u5e97\u4e0b\u8f7d\u201cPydroid 3\u201d\u6216\u201cQPython\u201d\u7b49\u5e94\u7528\u3002\u5bf9\u4e8eiOS\u8bbe\u5907\uff0c\u53ef\u4ee5\u5728App Store\u4e2d\u67e5\u627e\u201cPythonista\u201d\u6216\u201cPyto\u201d\u7b49\u5e94\u7528\u7a0b\u5e8f\u3002\u8fd9\u4e9b\u5e94\u7528\u7a0b\u5e8f\u63d0\u4f9b\u4e86Python\u7684\u5f00\u53d1\u73af\u5883\u548c\u8fd0\u884c\u73af\u5883\uff0c\u65b9\u4fbf\u7528\u6237\u5728\u5e73\u677f\u4e0a\u7f16\u5199\u548c\u6d4b\u8bd5Python\u4ee3\u7801\u3002<\/p>\n<p><strong>\u662f\u5426\u53ef\u4ee5\u5728\u5e73\u677f\u4e0a\u4f7f\u7528Python\u8fdb\u884c\u590d\u6742\u7684\u5f00\u53d1\u9879\u76ee\uff1f<\/strong><br \/>\u867d\u7136\u5728\u5e73\u677f\u4e0a\u53ef\u4ee5\u5b89\u88c5Python\u73af\u5883\uff0c\u4f46\u8fdb\u884c\u590d\u6742\u7684\u5f00\u53d1\u9879\u76ee\u53ef\u80fd\u4f1a\u53d7\u5230\u9650\u5236\u3002\u5e73\u677f\u7684\u786c\u4ef6\u6027\u80fd\u548c\u8f93\u5165\u65b9\u5f0f\u4e0e\u4f20\u7edf\u7535\u8111\u6709\u6240\u4e0d\u540c\uff0c\u53ef\u80fd\u4f1a\u5f71\u54cd\u5f00\u53d1\u4f53\u9a8c\u3002\u5bf9\u4e8e\u5927\u578b\u9879\u76ee\uff0c\u5efa\u8bae\u5728PC\u4e0a\u8fdb\u884c\u5f00\u53d1\uff0c\u800c\u5728\u5e73\u677f\u4e0a\u8fdb\u884c\u5c0f\u578b\u9879\u76ee\u6216\u5b66\u4e60Python\u7f16\u7a0b\u3002<\/p>\n<p><strong>\u5728\u5e73\u677f\u4e0a\u4f7f\u7528Python\u65f6\uff0c\u5982\u4f55\u5904\u7406\u7b2c\u4e09\u65b9\u5e93\u7684\u5b89\u88c5\uff1f<\/strong><br \/>\u5728\u5e73\u677f\u4e0a\u4f7f\u7528Python\u65f6\uff0c\u7b2c\u4e09\u65b9\u5e93\u7684\u5b89\u88c5\u53ef\u80fd\u4f1a\u6709\u6240\u4e0d\u540c\u3002\u5728Android\u8bbe\u5907\u4e0a\uff0c\u4e00\u4e9b\u5e94\u7528\uff0c\u5982Pydroid 3\uff0c\u63d0\u4f9b\u4e86\u5185\u7f6e\u7684\u5305\u7ba1\u7406\u5668\uff0c\u5141\u8bb8\u7528\u6237\u65b9\u4fbf\u5730\u5b89\u88c5\u6240\u9700\u7684\u5e93\u3002\u5728iOS\u8bbe\u5907\u4e0a\uff0c\u5e93\u7684\u652f\u6301\u53ef\u80fd\u6709\u9650\uff0c\u4f46\u4e00\u4e9b\u5e94\u7528\uff08\u5982Pythonista\uff09\u4e5f\u63d0\u4f9b\u4e86\u7279\u5b9a\u5e93\u7684\u652f\u6301\u3002\u786e\u4fdd\u67e5\u770b\u6240\u4f7f\u7528\u5e94\u7528\u7684\u6587\u6863\uff0c\u4ee5\u4e86\u89e3\u5982\u4f55\u5b89\u88c5\u548c\u7ba1\u7406\u5e93\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728\u5e73\u677f\u4e0a\u5b89\u88c5Python\uff0c\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528Python\u5e94\u7528\u5546\u5e97\u3001\u901a\u8fc7Termux\u3001\u5b89\u88c5Pydroid\u5e94\u7528\u7b49\u65b9\u5f0f\u8fdb\u884c [&hellip;]","protected":false},"author":3,"featured_media":1188086,"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\/1188071"}],"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=1188071"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1188071\/revisions"}],"predecessor-version":[{"id":1188087,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1188071\/revisions\/1188087"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1188086"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1188071"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1188071"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1188071"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}