{"id":174085,"date":"2024-05-08T18:24:38","date_gmt":"2024-05-08T10:24:38","guid":{"rendered":""},"modified":"2024-05-08T18:24:43","modified_gmt":"2024-05-08T10:24:43","slug":"%e4%ba%91%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%b8%8a%e5%a6%82%e4%bd%95%e8%bf%90%e8%a1%8cpython%e7%a8%8b%e5%ba%8f-2","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/174085.html","title":{"rendered":"\u4e91\u670d\u52a1\u5668\u4e0a\u5982\u4f55\u8fd0\u884cpython\u7a0b\u5e8f"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/27050224\/fc097380-afb8-4df8-ae47-3f986dad1844.webp\" alt=\"\u4e91\u670d\u52a1\u5668\u4e0a\u5982\u4f55\u8fd0\u884cpython\u7a0b\u5e8f\" \/><\/p>\n<p><p><strong>\u4e91\u670d\u52a1\u5668\u8fd0\u884cPython\u7a0b\u5e8f<\/strong>\u7684\u5173\u952e\u5728\u4e8e\u5b89\u88c5Python\u73af\u5883\u3001\u4f7f\u7528SSH\u8fdc\u7a0b\u8fde\u63a5\u3001\u4e0a\u4f20Python\u4ee3\u7801\u3001\u8bbe\u7f6e\u7a0b\u5e8f\u8fd0\u884c\u6743\u9650\u548c\u73af\u5883\u53d8\u91cf\uff0c\u4ee5\u53ca\u901a\u8fc7\u547d\u4ee4\u884c\u6216\u811a\u672c\u542f\u52a8\u7a0b\u5e8f\u3002\u9996\u5148\uff0c\u9700\u8981\u901a\u8fc7SSH\u5ba2\u6237\u7aef\u8fde\u63a5\u5230\u4e91\u670d\u52a1\u5668\uff0c\u8fdb\u884c\u5b89\u5168\u8ba4\u8bc1\u540e\u8fdb\u5165\u7cfb\u7edf\u3002\u5176\u6b21\uff0c\u5728\u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u5408\u9002\u7684Python\u7248\u672c\u5e76\u914d\u7f6e\u597d\u73af\u5883\u53d8\u91cf\uff0c\u4ee5\u4fbf\u53ef\u4ee5\u5728\u4efb\u610f\u76ee\u5f55\u8fd0\u884cPython\u6307\u4ee4\u3002\u4e3a\u7a0b\u5e8f\u6587\u4ef6\u8bbe\u7f6e\u9002\u5f53\u7684\u8fd0\u884c\u6743\u9650\u662f\u9632\u6b62\u6267\u884c\u65f6\u6743\u9650\u4e0d\u8db3\u5bfc\u81f4\u7a0b\u5e8f\u65e0\u6cd5\u8fd0\u884c\u3002\u6700\u540e\uff0c\u901a\u8fc7\u7f16\u5199\u7b80\u5355\u547d\u4ee4\u6216\u811a\u672c\u6765\u6267\u884cPython\u7a0b\u5e8f\uff0c\u82e5\u662f\u957f\u65f6\u95f4\u8fd0\u884c\u7684\u670d\u52a1\u7a0b\u5e8f\uff0c\u8fd8\u9700\u8bbe\u7f6e\u7a0b\u5e8f\u5b88\u62a4\u6216\u4f7f\u7528\u4efb\u52a1\u8c03\u5ea6\u6765\u4fdd\u8bc1\u670d\u52a1\u7684\u6301\u7eed\u7a33\u5b9a\u8fd0\u884c\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001SSH\u8fdc\u7a0b\u8fde\u63a5\u5230\u4e91\u670d\u52a1\u5668<\/h3>\n<\/p>\n<p><p><strong>\u8fdc\u7a0b\u8fde\u63a5<\/strong>\u662f\u63a7\u5236\u4e91\u670d\u52a1\u5668\u8fd0\u884cPython\u7a0b\u5e8f\u7684\u7b2c\u4e00\u6b65\u3002\u4e00\u822c\u800c\u8a00\uff0c\u6211\u4eec\u4f7f\u7528SSH\uff08Secure Shell\uff09\u534f\u8bae\u8fdb\u884c\u5b89\u5168\u8fdc\u7a0b\u64cd\u4f5c\u3002\u5728\u7c7bUnix\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u7ec8\u7aef\u5185\u7f6e\u7684ssh\u547d\u4ee4\u8fdb\u884c\u8fde\u63a5\uff0c\u800c\u5728Windows\u7cfb\u7edf\u4e0a\uff0c\u53ef\u4ee5\u4f7f\u7528\u50cfPuTTY\u8fd9\u6837\u7684SSH\u5ba2\u6237\u7aef\u8f6f\u4ef6\u3002<\/p>\n<\/p>\n<ol>\n<li>\u82e5\u4f7f\u7528\u7684\u662fLinux\u6216Mac OS\uff0c\u6253\u5f00\u7ec8\u7aef\u7a0b\u5e8f\u540e\u8f93\u5165 <code>ssh \u7528\u6237\u540d@\u670d\u52a1\u5668IP\u5730\u5740<\/code>\uff0c\u6309\u4e0b\u56de\u8f66\u952e\u5373\u53ef\u5c1d\u8bd5\u8fde\u63a5\u3002<\/li>\n<li>\u5982\u679c\u662fWindows\u7528\u6237\uff0c\u6253\u5f00PuTTY\u7a0b\u5e8f\uff0c\u8f93\u5165\u670d\u52a1\u5668\u7684IP\u5730\u5740\u548c\u7aef\u53e3\uff08\u901a\u5e38\u662f22\uff09\uff0c\u70b9\u51fb\u201cOpen\u201d\u5373\u53ef\u5c1d\u8bd5\u8fde\u63a5\u3002<\/li>\n<\/ol>\n<p><p>\u8fde\u63a5\u6210\u529f\u540e\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u8f93\u5165\u670d\u52a1\u5668\u7684\u7528\u6237\u5bc6\u7801\u8fdb\u884c\u6700\u7ec8\u8ba4\u8bc1\u3002\u8f93\u5165\u5bc6\u7801\u540e\u4fbf\u6210\u529f\u767b\u9646\u5230\u670d\u52a1\u5668\u4e0a\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u5b89\u88c5\u4e0e\u914d\u7f6ePython\u73af\u5883<\/h3>\n<\/p>\n<p><p>\u5728\u4e91\u670d\u52a1\u5668\u4e0a\uff0c\u53ef\u80fdPython\u73af\u5883\u672a\u88ab\u9884\u88c5\uff0c\u6216\u8005\u9884\u88c5\u7684\u7248\u672c\u4e0d\u7b26\u5408\u7a0b\u5e8f\u8981\u6c42\uff0c\u7528\u6237\u9700\u8981\u81ea\u884c<strong>\u5b89\u88c5Python\u73af\u5883<\/strong>\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p>\u5b89\u88c5Python\u73af\u5883\u901a\u5e38\u53ef\u4ee5\u901a\u8fc7\u670d\u52a1\u5668\u4e0a\u7684\u5305\u7ba1\u7406\u5668\u8fdb\u884c\u3002\u4ee5Ubuntu\u7cfb\u7edf\u4e3a\u4f8b\uff0c\u53ef\u4ee5\u4f7f\u7528APT\u5305\u7ba1\u7406\u5668\uff1b\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u5373\u53ef\u5b89\u88c5Python\uff1a<\/p>\n<\/p>\n<p><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>\n<p>\u5b89\u88c5\u540e\u9a8c\u8bc1Python\u662f\u5426\u6b63\u786e\u5b89\u88c5\u53ca\u7248\u672c\u53f7\uff0c\u4f7f\u7528\u547d\u4ee4 <code>python3 --version<\/code>\u3002\u82e5\u9700\u8981\u5b89\u88c5pip\uff08Python\u5305\u7ba1\u7406\u5de5\u5177\uff09\uff0c\u5e94\u4f7f\u7528\u547d\u4ee4 <code>sudo apt install python3-pip<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u4e09\u3001\u4e0a\u4f20Python\u4ee3\u7801\u5230\u670d\u52a1\u5668<\/h3>\n<\/p>\n<p><p>\u4e0a\u4f20\u4ee3\u7801\u81f3\u4e91\u670d\u52a1\u5668\u6709\u591a\u79cd\u65b9\u5f0f\uff0c\u6700\u5e38\u89c1\u7684\u662f\u4f7f\u7528<strong>FTP\uff08\u6587\u4ef6\u4f20\u8f93\u534f\u8bae\uff09<strong>\u6216<\/strong>SCP\uff08\u5b89\u5168\u62f7\u8d1d\u534f\u8bae\uff09<\/strong>\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p>FTP\u4e0a\u4f20\u53ef\u4ee5\u4f7f\u7528\u50cfFileZilla\u8fd9\u6837\u7684\u56fe\u5f62\u754c\u9762FTP\u5ba2\u6237\u7aef\u3002\u914d\u7f6e\u597d\u670d\u52a1\u5668\u767b\u5f55\u4fe1\u606f\u540e\uff0c\u5373\u53ef\u901a\u8fc7\u62d6\u653e\u7684\u65b9\u5f0f\u4e0a\u4f20\u6587\u4ef6\u5230\u6307\u5b9a\u76ee\u5f55\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p>SCP\u4e0a\u4f20\u5219\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e2d\u5b8c\u6210\uff0c\u547d\u4ee4\u683c\u5f0f\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">scp -P \u7aef\u53e3\u53f7 \u672c\u5730\u6587\u4ef6\u8def\u5f84 \u7528\u6237\u540d@\u670d\u52a1\u5668IP\u5730\u5740:\u670d\u52a1\u5668\u76ee\u6807\u8def\u5f84<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u5728\u9009\u62e9\u4e0a\u4f20\u8def\u5f84\u65f6\uff0c\u6700\u4f73\u5b9e\u8df5\u662f\u5c06\u9879\u76ee\u653e\u7f6e\u5728\u4e00\u4e2a\u7528\u6237\u5177\u6709\u5b8c\u5168\u6743\u9650\u7684\u8def\u5f84\u4e0b\uff0c\u8fd9\u6709\u52a9\u4e8e\u540e\u7eed\u7684\u7ba1\u7406\u548c\u7ef4\u62a4\u5de5\u4f5c\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u8bbe\u7f6e\u8fd0\u884c\u6743\u9650\u548c\u73af\u5883\u53d8\u91cf<\/h3>\n<\/p>\n<p><p>\u4e0a\u4f20\u540e\u7684Python\u6587\u4ef6\u9ed8\u8ba4\u53ef\u80fd\u6ca1\u6709\u6267\u884c\u6743\u9650\uff0c\u9700\u8981\u5bf9\u5176\u8fdb\u884c<strong>\u6743\u9650\u8bbe\u7f6e<\/strong>\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p>\u4f7f\u7528 <code>chmod<\/code> \u547d\u4ee4\u7ed9\u4e88\u6587\u4ef6\u6267\u884c\u6743\u9650\uff0c\u4f8b\u5982\uff0c\u547d\u4ee4 <code>chmod +x your_script.py<\/code> \u8d4b\u4e88\u811a\u672c\u53ef\u6267\u884c\u6743\u9650\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p>\u5982\u679cPython\u7a0b\u5e8f\u9700\u8981\u4f7f\u7528\u5230\u73af\u5883\u53d8\u91cf\uff0c\u9700\u5728\u670d\u52a1\u5668\u4e0a\u6b63\u786e\u8bbe\u7f6e\u3002\u53ef\u4ee5\u5c06\u73af\u5883\u53d8\u91cf\u5199\u5165 <code>~\/.bashrc<\/code> \u6216 <code>~\/.profile<\/code> \u4e2d\uff0c\u7136\u540e\u901a\u8fc7 <code>source ~\/.bashrc<\/code> \u547d\u4ee4\u4f7f\u5176\u751f\u6548\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u4e94\u3001\u8fd0\u884cPython\u7a0b\u5e8f<\/h3>\n<\/p>\n<p><p>\u62e5\u6709\u4e86\u6267\u884c\u6743\u9650\u548c\u5b8c\u5907\u7684\u73af\u5883\u8bbe\u7f6e\u540e\uff0c\u5c31\u53ef\u4ee5\u8fd0\u884cPython\u7a0b\u5e8f\u4e86\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684<strong>\u542f\u52a8\u65b9\u5f0f<\/strong>\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p>\u76f4\u63a5\u901a\u8fc7Python\u89e3\u91ca\u5668\u6765\u8fd0\u884c\uff0c\u547d\u4ee4\u683c\u5f0f\uff1a<code>python3 your_script.py<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p>\u5982\u679c\u811a\u672c\u5934\u90e8\u5df2\u7ecf\u6307\u5b9a\u4e86Python\u89e3\u91ca\u5668\uff08\u5982 <code>#!\/usr\/bin\/env python3<\/code>\uff09\uff0c\u90a3\u4e48\u53ef\u4ee5\u76f4\u63a5\u4ee5 <code>.\/your_script.py<\/code> \u7684\u5f62\u5f0f\u8fd0\u884c\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u516d\u3001\u8fdb\u9636\uff1a\u8bbe\u7f6e\u7a0b\u5e8f\u6301\u4e45\u5316\u8fd0\u884c<\/h3>\n<\/p>\n<p><p>\u4e91\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\u7684Python\u7a0b\u5e8f\u901a\u5e38\u5e0c\u671b\u53ef\u4ee5\u6301\u7eed\u8fd0\u884c\uff0c\u5373\u4f7f\u7528\u6237\u65ad\u5f00\u4e86SSH\u8fde\u63a5\u4e5f\u4e0d\u4f1a\u5f71\u54cd\u3002\u5b9e\u73b0\u8fd9\u4e00\u70b9\uff0c\u6709\u4ee5\u4e0b\u4e24\u79cd\u65b9\u6848\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p>\u4f7f\u7528\u5982 <code>nohup<\/code> \u547d\u4ee4\uff0c\u5b83\u53ef\u4ee5\u4f7f\u7a0b\u5e8f\u5728\u7528\u6237\u767b\u51fa\u540e\u7ee7\u7eed\u8fd0\u884c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">nohup python3 your_script.py &amp;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p>\u4f7f\u7528 <code>screen<\/code> \u6216 <code>tmux<\/code> \u7b49\u7ec8\u7aef\u590d\u7528\u8f6f\u4ef6\uff0c\u53ef\u4ee5\u5728\u4e00\u4e2a\u6216\u591a\u4e2a\u865a\u62df\u4f1a\u8bdd\u4e2d\u8fd0\u884c\u7a0b\u5e8f\uff0c\u5e76\u5141\u8bb8\u7528\u6237\u8131\u79bb\u548c\u6062\u590d\u4f1a\u8bdd\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u4e03\u3001\u76d1\u63a7\u548c\u65e5\u5fd7\u7ba1\u7406<\/h3>\n<\/p>\n<p><p><strong>\u76d1\u63a7\u7a0b\u5e8f\u72b6\u6001<\/strong>\u548c<strong>\u65e5\u5fd7\u7ba1\u7406<\/strong>\u5bf9\u4e8e\u751f\u4ea7\u73af\u5883\u4e2d\u7684Python\u7a0b\u5e8f\u6765\u8bf4\u81f3\u5173\u91cd\u8981\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p>\u76d1\u63a7\u53ef\u4ee5\u4f7f\u7528\u50cftop\u3001htop\u8fd9\u6837\u7684\u5de5\u5177\u67e5\u770b\u5b9e\u65f6\u7cfb\u7edf\u8d44\u6e90\u4f7f\u7528\u60c5\u51b5\uff0c\u786e\u8ba4\u7a0b\u5e8f\u662f\u5426\u5065\u5eb7\u8fd0\u884c\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p>\u65e5\u5fd7\u8bb0\u5f55\u662f\u8ffd\u8e2a\u7a0b\u5e8f\u8fd0\u884c\u4e2d\u53ef\u80fd\u51fa\u73b0\u7684\u95ee\u9898\u7684\u5173\u952e\u3002\u53ef\u4ee5\u5728Python\u7a0b\u5e8f\u4e2d\u4f7f\u7528logging\u6a21\u5757\u6765\u5b9e\u73b0\u65e5\u5fd7\u7684\u8bb0\u5f55\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u7efc\u4e0a\uff0c\u8fd0\u884cPython\u7a0b\u5e8f\u5728\u4e91\u670d\u52a1\u5668\u4e0a\u9700\u8981\u4e00\u5b9a\u7684\u914d\u7f6e\u4e0e\u7ba1\u7406\uff0c\u4f46\u9075\u5faa\u8fd9\u4e9b\u6b65\u9aa4\uff0c\u7528\u6237\u53ef\u4ee5\u6709\u6548\u5730\u542f\u52a8\u5e76\u7ef4\u62a4\u4ed6\u4eec\u7684Python\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>1. \u5982\u4f55\u5728\u4e91\u670d\u52a1\u5668\u4e0a\u8fd0\u884cPython\u7a0b\u5e8f\uff1f<\/strong><\/p>\n<p>\u4e91\u670d\u52a1\u5668\u662f\u4e00\u4e2a\u8fdc\u7a0b\u8ba1\u7b97\u8d44\u6e90\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u8fdc\u7a0b\u767b\u5f55\u5230\u4e91\u670d\u52a1\u5668\u4e0a\uff0c\u7136\u540e\u5728\u670d\u52a1\u5668\u7684\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u8fd0\u884cPython\u7a0b\u5e8f\u3002\u60a8\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u5728\u4e91\u670d\u52a1\u5668\u4e0a\u8fd0\u884cPython\u7a0b\u5e8f\uff1a<\/p>\n<ul>\n<li>\u9996\u5148\uff0c\u767b\u5f55\u5230\u4e91\u670d\u52a1\u5668\u7684\u63a7\u5236\u53f0\u6216\u4f7f\u7528SSH\u5de5\u5177\u8fdc\u7a0b\u767b\u5f55\u5230\u670d\u52a1\u5668\u3002<\/li>\n<li>\u5176\u6b21\uff0c\u786e\u4fdd\u670d\u52a1\u5668\u4e0a\u5df2\u7ecf\u5b89\u88c5\u4e86Python\u89e3\u91ca\u5668\u3002\u5982\u679c\u6ca1\u6709\u5b89\u88c5\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u5305\u7ba1\u7406\u5de5\u5177\uff08\u5982apt\u3001yum\uff09\u8fdb\u884c\u5b89\u88c5\u3002<\/li>\n<li>\u7136\u540e\uff0c\u5c06\u60a8\u7684Python\u7a0b\u5e8f\u6587\u4ef6\u4f20\u8f93\u5230\u4e91\u670d\u52a1\u5668\u4e0a\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528SCP\uff08Secure Copy\uff09\u547d\u4ee4\u6216\u8005FTP\u5de5\u5177\u6765\u5b9e\u73b0\u6587\u4ef6\u4f20\u8f93\u3002<\/li>\n<li>\u63a5\u4e0b\u6765\uff0c\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177\u6216\u7ec8\u7aef\u7a97\u53e3\u5bfc\u822a\u5230Python\u7a0b\u5e8f\u6587\u4ef6\u6240\u5728\u7684\u76ee\u5f55\u3002<\/li>\n<li>\u6700\u540e\uff0c\u8fd0\u884c\u60a8\u7684Python\u7a0b\u5e8f\u3002\u901a\u8fc7\u5728\u547d\u4ee4\u884c\u4e2d\u952e\u5165<code>python your_program.py<\/code>\u6765\u6267\u884c\u60a8\u7684Python\u7a0b\u5e8f\u3002<\/li>\n<\/ul>\n<p><strong>2. \u5982\u4f55\u5728\u4e91\u670d\u52a1\u5668\u4e0a\u90e8\u7f72Python Web\u5e94\u7528\uff1f<\/strong><\/p>\n<p>\u8981\u5728\u4e91\u670d\u52a1\u5668\u4e0a\u90e8\u7f72Python Web\u5e94\u7528\uff0c\u60a8\u53ef\u4ee5\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<ul>\n<li>\u9996\u5148\uff0c\u786e\u4fdd\u60a8\u5df2\u7ecf\u5b89\u88c5\u4e86\u5408\u9002\u7684Web\u670d\u52a1\u5668\u8f6f\u4ef6\uff0c\u6bd4\u5982Nginx\u6216Apache\u3002<\/li>\n<li>\u5176\u6b21\uff0c\u4e3a\u60a8\u7684Python Web\u5e94\u7528\u521b\u5efa\u4e00\u4e2a\u865a\u62df\u73af\u5883\uff0c\u4ee5\u4fbf\u9694\u79bb\u5e94\u7528\u7684\u4f9d\u8d56\u548c\u8fd0\u884c\u73af\u5883\u3002<\/li>\n<li>\u7136\u540e\uff0c\u5c06\u60a8\u7684Python Web\u5e94\u7528\u6587\u4ef6\u90e8\u7f72\u5230\u4e91\u670d\u52a1\u5668\u4e0a\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528Git\u6765\u5c06\u4ee3\u7801\u4ece\u4ee3\u7801\u5e93\u4e2d\u62c9\u53d6\u5230\u670d\u52a1\u5668\u4e0a\uff0c\u6216\u8005\u4f7f\u7528SCP\u547d\u4ee4\u8fdb\u884c\u6587\u4ef6\u4f20\u8f93\u3002<\/li>\n<li>\u63a5\u4e0b\u6765\uff0c\u5b89\u88c5\u5e76\u914d\u7f6eWeb\u670d\u52a1\u5668\u8f6f\u4ef6\uff0c\u4ee5\u4fbf\u80fd\u591f\u5904\u7406Python Web\u5e94\u7528\u7684\u8bf7\u6c42\u3002<\/li>\n<li>\u6700\u540e\uff0c\u542f\u52a8Web\u670d\u52a1\u5668\u8f6f\u4ef6\uff0c\u5e76\u901a\u8fc7\u6d4f\u89c8\u5668\u8bbf\u95ee\u60a8\u7684\u5e94\u7528\u3002<\/li>\n<\/ul>\n<p><strong>3. \u5982\u4f55\u5728\u4e91\u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u548c\u7ba1\u7406Python\u7684\u4f9d\u8d56\u5305\uff1f<\/strong><\/p>\n<p>\u5728\u4e91\u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u548c\u7ba1\u7406Python\u7684\u4f9d\u8d56\u5305\u975e\u5e38\u91cd\u8981\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u6cd5\u5b9e\u73b0\uff1a<\/p>\n<ul>\n<li>\u9996\u5148\uff0c\u4f7f\u7528pip\u5de5\u5177\u6765\u5b89\u88c5Python\u4f9d\u8d56\u5305\u3002\u5728\u547d\u4ee4\u884c\u4e2d\u8fd0\u884c<code>pip install package_name<\/code>\u5373\u53ef\u5b89\u88c5\u6240\u9700\u7684\u5305\u3002<\/li>\n<li>\u5176\u6b21\uff0c\u53ef\u4ee5\u4f7f\u7528\u865a\u62df\u73af\u5883\u6765\u9694\u79bb\u4e0d\u540c\u9879\u76ee\u7684\u4f9d\u8d56\u5305\u3002\u865a\u62df\u73af\u5883\u5141\u8bb8\u60a8\u5728\u540c\u4e00\u53f0\u673a\u5668\u4e0a\u7ef4\u62a4\u591a\u4e2a\u9879\u76ee\uff0c\u5e76\u786e\u4fdd\u5b83\u4eec\u4e4b\u95f4\u7684\u4f9d\u8d56\u5305\u4e0d\u4f1a\u76f8\u4e92\u51b2\u7a81\u3002<\/li>\n<li>\u7136\u540e\uff0c\u901a\u8fc7\u7f16\u8f91\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\u7684<code>requirements.txt<\/code>\u6587\u4ef6\uff0c\u6765\u8bb0\u5f55\u9879\u76ee\u6240\u9700\u7684\u4f9d\u8d56\u5305\u53ca\u5176\u7248\u672c\u3002\u7136\u540e\u4f7f\u7528<code>pip install -r requirements.txt<\/code>\u547d\u4ee4\u6765\u5b89\u88c5\u6240\u6709\u4f9d\u8d56\u5305\u3002<\/li>\n<li>\u63a5\u4e0b\u6765\uff0c\u53ef\u4ee5\u4f7f\u7528pip\u5de5\u5177\u6765\u66f4\u65b0\u548c\u5378\u8f7d\u4f9d\u8d56\u5305\uff0c\u4ee5\u6ee1\u8db3\u9879\u76ee\u7684\u9700\u6c42\u3002\u4f8b\u5982\uff0c<code>pip install --upgrade package_name<\/code>\u7528\u4e8e\u66f4\u65b0\u4f9d\u8d56\u5305\u81f3\u6700\u65b0\u7248\u672c\uff0c<code>pip uninstall package_name<\/code>\u7528\u4e8e\u5378\u8f7d\u4e0d\u9700\u8981\u7684\u4f9d\u8d56\u5305\u3002<\/li>\n<li>\u6700\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528\u5305\u7ba1\u7406\u5de5\u5177\uff08\u5982apt\u3001yum\uff09\u6765\u5b89\u88c5\u7cfb\u7edf\u7ea7\u4f9d\u8d56\u5305\uff0c\u4ee5\u4fbf\u4e8e\u5728\u4e91\u670d\u52a1\u5668\u4e2d\u5b89\u88c5\u4e00\u4e9b\u9700\u8981\u7f16\u8bd1\u7684\u4f9d\u8d56\u5305\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"\u4e91\u670d\u52a1\u5668\u8fd0\u884cPython\u7a0b\u5e8f\u7684\u5173\u952e\u5728\u4e8e\u5b89\u88c5Python\u73af\u5883\u3001\u4f7f\u7528SSH\u8fdc\u7a0b\u8fde\u63a5\u3001\u4e0a\u4f20Python\u4ee3\u7801\u3001\u8bbe\u7f6e\u7a0b\u5e8f [&hellip;]","protected":false},"author":3,"featured_media":174090,"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\/174085"}],"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=174085"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/174085\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/174090"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=174085"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=174085"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=174085"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}