{"id":1095122,"date":"2025-01-08T14:48:03","date_gmt":"2025-01-08T06:48:03","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1095122.html"},"modified":"2025-01-08T14:48:05","modified_gmt":"2025-01-08T06:48:05","slug":"python%e4%bf%9d%e5%ad%98%e5%90%8e%e7%9a%84%e6%96%87%e4%bb%b6%e5%a6%82%e4%bd%95%e5%86%8d%e6%ac%a1%e8%bf%90%e8%a1%8c-2","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1095122.html","title":{"rendered":"python\u4fdd\u5b58\u540e\u7684\u6587\u4ef6\u5982\u4f55\u518d\u6b21\u8fd0\u884c"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24210932\/876e00a1-2820-4753-8991-59327761ba28.webp\" alt=\"python\u4fdd\u5b58\u540e\u7684\u6587\u4ef6\u5982\u4f55\u518d\u6b21\u8fd0\u884c\" \/><\/p>\n<p><p> <strong>Python\u4fdd\u5b58\u540e\u7684\u6587\u4ef6\u5982\u4f55\u518d\u6b21\u8fd0\u884c<\/strong><\/p>\n<\/p>\n<p><p>\u5f53\u6211\u4eec\u4f7f\u7528Python\u7f16\u5199\u5e76\u4fdd\u5b58\u4e00\u4e2a\u811a\u672c\u6587\u4ef6\u540e\uff0c\u901a\u5e38\u4f1a\u5e0c\u671b\u80fd\u591f\u518d\u6b21\u8fd0\u884c\u8fd9\u4e2a\u6587\u4ef6\uff0c\u4ee5\u4fbf\u68c0\u67e5\u5176\u529f\u80fd\u662f\u5426\u6b63\u5e38\uff0c\u6216\u8005\u5728\u672a\u6765\u7684\u67d0\u4e2a\u65f6\u5019\u518d\u6b21\u5229\u7528\u8fd9\u4e2a\u811a\u672c\u3002<strong>\u4fdd\u5b58\u540e\u7684Python\u6587\u4ef6\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\u518d\u6b21\u8fd0\u884c\uff0c\u4f8b\u5982\u4f7f\u7528\u547d\u4ee4\u884c\u3001\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u6216\u901a\u8fc7\u53cc\u51fb\u6587\u4ef6\u7b49\u3002<\/strong>\u4e0b\u9762\u662f\u4e00\u4e9b\u8be6\u7ec6\u7684\u65b9\u6cd5\u548c\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u4f7f\u7528\u547d\u4ee4\u884c\u8fd0\u884cPython\u6587\u4ef6<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u547d\u4ee4\u884c\u8fd0\u884cPython\u6587\u4ef6\u662f\u6700\u76f4\u63a5\u548c\u901a\u7528\u7684\u65b9\u6cd5\u4e4b\u4e00\u3002\u65e0\u8bba\u60a8\u4f7f\u7528\u7684\u662fWindows\u3001macOS\u8fd8\u662fLinux\uff0c\u90fd\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u8fd0\u884cPython\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6253\u5f00\u547d\u4ee4\u884c\u5de5\u5177<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u5728Windows\u4e2d\uff0c\u6309\u4e0b <code>Win + R<\/code> \u952e\uff0c\u7136\u540e\u8f93\u5165 <code>cmd<\/code> \u5e76\u6309\u4e0b\u56de\u8f66\u952e\u3002<\/li>\n<li>\u5728macOS\u4e2d\uff0c\u60a8\u53ef\u4ee5\u6253\u5f00\u201c\u7ec8\u7aef\u201d\u5e94\u7528\u7a0b\u5e8f\u3002<\/li>\n<li>\u5728Linux\u4e2d\uff0c\u60a8\u53ef\u4ee5\u6253\u5f00\u60a8\u559c\u6b22\u7684\u7ec8\u7aef\u5e94\u7528\u7a0b\u5e8f\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u5bfc\u822a\u5230\u6587\u4ef6\u6240\u5728\u7684\u76ee\u5f55<\/strong><\/p>\n<\/p>\n<p><p> \u4f7f\u7528 <code>cd<\/code> \u547d\u4ee4\u5bfc\u822a\u5230\u5305\u542b\u60a8\u7684Python\u811a\u672c\u7684\u76ee\u5f55\u3002\u4f8b\u5982\uff0c\u5982\u679c\u60a8\u7684\u6587\u4ef6\u4f4d\u4e8e <code>C:\\Users\\YourName\\Documents<\/code> \u76ee\u5f55\u4e0b\uff0c\u60a8\u53ef\u4ee5\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">cd C:\\Users\\YourName\\Documents<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8fd0\u884cPython\u6587\u4ef6<\/strong><\/p>\n<\/p>\n<p><p> \u786e\u4fdd\u60a8\u5df2\u7ecf\u5b89\u88c5\u4e86Python\uff0c\u5e76\u4e14\u5df2\u7ecf\u8bbe\u7f6e\u4e86\u7cfb\u7edf\u8def\u5f84\uff08PATH\uff09\uff0c\u7136\u540e\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u8fd0\u884c\u60a8\u7684Python\u811a\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">python script_name.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p> \u5176\u4e2d\uff0c<code>script_name.py<\/code> \u662f\u60a8\u7684Python\u811a\u672c\u7684\u540d\u79f0\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e8c\u3001\u4f7f\u7528\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09<\/p>\n<\/p>\n<p><p>\u8bb8\u591a\u5f00\u53d1\u8005\u66f4\u559c\u6b22\u4f7f\u7528\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u6765\u7f16\u5199\u548c\u8fd0\u884cPython\u4ee3\u7801\u3002\u5e38\u89c1\u7684IDE\u5305\u62ecPyCharm\u3001VS Code\u3001Jupyter Notebook\u7b49\u3002\u4ee5\u4e0b\u662f\u4f7f\u7528IDE\u8fd0\u884cPython\u6587\u4ef6\u7684\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6253\u5f00IDE<\/strong><\/p>\n<\/p>\n<p><p> \u542f\u52a8\u60a8\u9009\u62e9\u7684IDE\u3002\u4f8b\u5982\uff0c\u6253\u5f00PyCharm\u6216VS Code\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5bfc\u5165\u6216\u6253\u5f00Python\u6587\u4ef6<\/strong><\/p>\n<\/p>\n<p><p> \u5728IDE\u4e2d\u6253\u5f00\u60a8\u4e4b\u524d\u4fdd\u5b58\u7684Python\u6587\u4ef6\u3002\u5927\u591a\u6570IDE\u90fd\u6709\u201c\u6253\u5f00\u6587\u4ef6\u201d\u9009\u9879\uff0c\u60a8\u53ea\u9700\u5bfc\u822a\u5230\u6587\u4ef6\u6240\u5728\u7684\u4f4d\u7f6e\u5e76\u9009\u62e9\u5b83\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8fd0\u884cPython\u6587\u4ef6<\/strong><\/p>\n<\/p>\n<p><p> \u5927\u591a\u6570IDE\u90fd\u6709\u5185\u7f6e\u7684\u8fd0\u884c\u6309\u94ae\u6216\u5feb\u6377\u952e\u3002\u4f8b\u5982\uff0c\u5728PyCharm\u4e2d\uff0c\u60a8\u53ef\u4ee5\u70b9\u51fb\u53f3\u4e0a\u89d2\u7684\u7eff\u8272\u8fd0\u884c\u6309\u94ae\uff0c\u6216\u8005\u6309\u4e0b <code>Shift + F10<\/code> \u5feb\u6377\u952e\u3002\u5728VS Code\u4e2d\uff0c\u60a8\u53ef\u4ee5\u6309\u4e0b <code>F5<\/code> \u952e\u8fdb\u884c\u8c03\u8bd5\u8fd0\u884c\uff0c\u6216\u8005\u70b9\u51fb\u53f3\u4e0a\u89d2\u7684\u8fd0\u884c\u6309\u94ae\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001\u901a\u8fc7\u53cc\u51fb\u6587\u4ef6\u8fd0\u884c\uff08\u4ec5\u9650Windows\uff09<\/p>\n<\/p>\n<p><p>\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u60a8\u8fd8\u53ef\u4ee5\u901a\u8fc7\u53cc\u51fbPython\u6587\u4ef6\u6765\u8fd0\u884c\u5b83\u3002\u4e3a\u4e86\u4f7f\u8fd9\u79cd\u65b9\u6cd5\u6709\u6548\uff0c\u60a8\u9700\u8981\u786e\u4fdd\u5df2\u6b63\u786e\u5b89\u88c5Python\uff0c\u5e76\u4e14\u6587\u4ef6\u7684\u6269\u5c55\u540d\u4e3a <code>.py<\/code>\u3002\u53cc\u51fb\u6587\u4ef6\u540e\uff0cWindows\u5c06\u4f7f\u7528\u9ed8\u8ba4\u7684Python\u89e3\u91ca\u5668\u6765\u8fd0\u884c\u8be5\u811a\u672c\u3002<\/p>\n<\/p>\n<p><p>\u56db\u3001\u901a\u8fc7\u4efb\u52a1\u8c03\u5ea6\u5668\u6216\u8ba1\u5212\u4efb\u52a1\u8fd0\u884c<\/p>\n<\/p>\n<p><p>\u6709\u65f6\uff0c\u60a8\u53ef\u80fd\u5e0c\u671b\u5b9a\u671f\u8fd0\u884c\u60a8\u7684Python\u811a\u672c\u3002\u4f8b\u5982\uff0c\u6bcf\u5929\u5b9a\u65f6\u6267\u884c\u4e00\u6b21\u6570\u636e\u5907\u4efd\u4efb\u52a1\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u64cd\u4f5c\u7cfb\u7edf\u7684\u4efb\u52a1\u8c03\u5ea6\u5668\u6765\u5b9e\u73b0\u8fd9\u4e00\u70b9\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>Windows\u4efb\u52a1\u8ba1\u5212\u7a0b\u5e8f<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u6253\u5f00\u4efb\u52a1\u8ba1\u5212\u7a0b\u5e8f\uff1a\u6309\u4e0b <code>Win + R<\/code> \u952e\uff0c\u8f93\u5165 <code>taskschd.msc<\/code> \u5e76\u6309\u4e0b\u56de\u8f66\u952e\u3002<\/li>\n<li>\u521b\u5efa\u4e00\u4e2a\u65b0\u4efb\u52a1\uff1a\u5728\u53f3\u4fa7\u7684\u201c\u64cd\u4f5c\u201d\u9762\u677f\u4e2d\uff0c\u9009\u62e9\u201c\u521b\u5efa\u57fa\u672c\u4efb\u52a1\u201d\u3002<\/li>\n<li>\u6309\u7167\u5411\u5bfc\u7684\u63d0\u793a\uff0c\u8bbe\u7f6e\u4efb\u52a1\u540d\u79f0\u3001\u89e6\u53d1\u5668\uff08\u4f8b\u5982\uff0c\u6bcf\u5929\u8fd0\u884c\u4e00\u6b21\uff09\u3001\u64cd\u4f5c\uff08\u4f8b\u5982\uff0c\u542f\u52a8\u7a0b\u5e8f\uff09\uff0c\u5e76\u9009\u62e9\u60a8\u7684Python\u811a\u672c\u3002<\/li>\n<li>\u4fdd\u5b58\u5e76\u8fd0\u884c\u4efb\u52a1\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>Linux\u4e2d\u7684Crontab<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u6253\u5f00\u7ec8\u7aef\u5e76\u8f93\u5165 <code>crontab -e<\/code> \u4ee5\u7f16\u8f91\u5f53\u524d\u7528\u6237\u7684crontab\u6587\u4ef6\u3002<\/li>\n<li>\u6dfb\u52a0\u4e00\u4e2a\u65b0\u7684cron\u4f5c\u4e1a\u3002\u4f8b\u5982\uff0c\u8981\u6bcf\u5929\u51cc\u66681\u70b9\u8fd0\u884c\u60a8\u7684Python\u811a\u672c\uff0c\u60a8\u53ef\u4ee5\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a<\/li>\n<\/ul>\n<p><pre><code class=\"language-shell\">0 1 * * * \/usr\/bin\/python3 \/path\/to\/your\/script.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ul>\n<li>\u4fdd\u5b58\u5e76\u9000\u51fa\u7f16\u8f91\u5668\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><p>\u4e94\u3001\u4f7f\u7528Docker\u5bb9\u5668\u8fd0\u884cPython\u6587\u4ef6<\/p>\n<\/p>\n<p><p>Docker\u662f\u4e00\u79cd\u5bb9\u5668\u5316\u6280\u672f\uff0c\u53ef\u4ee5\u5e2e\u52a9\u60a8\u5728\u9694\u79bb\u7684\u73af\u5883\u4e2d\u8fd0\u884cPython\u811a\u672c\u3002\u8fd9\u5bf9\u4e8e\u90e8\u7f72\u548c\u5206\u53d1Python\u5e94\u7528\u7a0b\u5e8f\u975e\u5e38\u6709\u7528\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u521b\u5efaDockerfile<\/strong><\/p>\n<\/p>\n<p><p> \u521b\u5efa\u4e00\u4e2a\u540d\u4e3a <code>Dockerfile<\/code> \u7684\u6587\u4ef6\uff0c\u5e76\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-dockerfile\">FROM python:3.8-slim<\/p>\n<p>WORKDIR \/app<\/p>\n<p>COPY . \/app<\/p>\n<p>RUN pip install -r requirements.txt<\/p>\n<p>CMD [&quot;python&quot;, &quot;script_name.py&quot;]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p> \u5176\u4e2d\uff0c<code>requirements.txt<\/code> \u662f\u60a8\u7684\u4f9d\u8d56\u5305\u5217\u8868\uff0c<code>script_name.py<\/code> \u662f\u60a8\u7684Python\u811a\u672c\u540d\u79f0\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6784\u5efaDocker\u955c\u50cf<\/strong><\/p>\n<\/p>\n<p><p> \u6253\u5f00\u7ec8\u7aef\u5e76\u5bfc\u822a\u5230\u5305\u542bDockerfile\u7684\u76ee\u5f55\uff0c\u7136\u540e\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6784\u5efaDocker\u955c\u50cf\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">docker build -t my-python-app .<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8fd0\u884cDocker\u5bb9\u5668<\/strong><\/p>\n<\/p>\n<p><p> \u6784\u5efa\u5b8c\u6210\u540e\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8fd0\u884cDocker\u5bb9\u5668\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">docker run my-python-app<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u516d\u3001\u901a\u8fc7\u4e91\u670d\u52a1\u8fd0\u884cPython\u6587\u4ef6<\/p>\n<\/p>\n<p><p>\u5982\u679c\u60a8\u9700\u8981\u5728\u4e91\u7aef\u8fd0\u884cPython\u811a\u672c\uff0c\u53ef\u4ee5\u9009\u62e9\u4f7f\u7528\u4e91\u670d\u52a1\uff0c\u4f8b\u5982Amazon Web Services\uff08AWS\uff09\u3001Google Cloud Platform\uff08GCP\uff09\u6216Microsoft Azure\u3002\u8fd9\u4e9b\u5e73\u53f0\u63d0\u4f9b\u4e86\u591a\u79cd\u8fd0\u884cPython\u811a\u672c\u7684\u65b9\u5f0f\uff0c\u5305\u62ecLambda\u51fd\u6570\u3001Google Cloud Functions\u3001Azure Functions\u7b49\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>AWS Lambda<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u767b\u5f55AWS\u7ba1\u7406\u63a7\u5236\u53f0\uff0c\u5bfc\u822a\u5230\u201cLambda\u201d\u670d\u52a1\u3002<\/li>\n<li>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Lambda\u51fd\u6570\uff0c\u9009\u62e9Python\u4f5c\u4e3a\u8fd0\u884c\u65f6\u3002<\/li>\n<li>\u4e0a\u4f20\u60a8\u7684Python\u811a\u672c\uff0c\u5e76\u8bbe\u7f6e\u89e6\u53d1\u5668\uff08\u4f8b\u5982\uff0c\u57fa\u4e8e\u65f6\u95f4\u7684CloudWatch\u4e8b\u4ef6\uff09\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>Google Cloud Functions<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u767b\u5f55GCP\u63a7\u5236\u53f0\uff0c\u5bfc\u822a\u5230\u201cCloud Functions\u201d\u3002<\/li>\n<li>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u51fd\u6570\uff0c\u9009\u62e9Python\u4f5c\u4e3a\u8fd0\u884c\u65f6\u3002<\/li>\n<li>\u4e0a\u4f20\u60a8\u7684Python\u811a\u672c\uff0c\u5e76\u8bbe\u7f6e\u89e6\u53d1\u5668\uff08\u4f8b\u5982\uff0c\u57fa\u4e8e\u65f6\u95f4\u7684Cloud Scheduler\uff09\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>Azure Functions<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u767b\u5f55Azure\u95e8\u6237\uff0c\u5bfc\u822a\u5230\u201c\u51fd\u6570\u5e94\u7528\u201d\u3002<\/li>\n<li>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u51fd\u6570\u5e94\u7528\uff0c\u9009\u62e9Python\u4f5c\u4e3a\u8fd0\u884c\u65f6\u3002<\/li>\n<li>\u4e0a\u4f20\u60a8\u7684Python\u811a\u672c\uff0c\u5e76\u8bbe\u7f6e\u89e6\u53d1\u5668\uff08\u4f8b\u5982\uff0c\u57fa\u4e8e\u65f6\u95f4\u7684Azure Timer Trigger\uff09\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><p>\u4e03\u3001\u4f7f\u7528\u7b2c\u4e09\u65b9\u5de5\u5177\u6216\u6846\u67b6\u8fd0\u884cPython\u6587\u4ef6<\/p>\n<\/p>\n<p><p>\u9664\u4e86\u4e0a\u8ff0\u65b9\u6cd5\u5916\uff0c\u8fd8\u6709\u8bb8\u591a\u7b2c\u4e09\u65b9\u5de5\u5177\u548c\u6846\u67b6\u53ef\u4ee5\u5e2e\u52a9\u60a8\u8fd0\u884c\u548c\u7ba1\u7406Python\u811a\u672c\u3002\u4f8b\u5982\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528Celery\u6765\u5904\u7406\u5f02\u6b65\u4efb\u52a1\uff0c\u4f7f\u7528<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>rflow\u6765\u7ba1\u7406\u5de5\u4f5c\u6d41\uff0c\u6216\u4f7f\u7528Jenkins\u6765\u6267\u884c\u6301\u7eed\u96c6\u6210\u548c\u90e8\u7f72\u4efb\u52a1\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>Celery<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u5b89\u88c5Celery\u548c\u6240\u9700\u7684\u6d88\u606f\u4ee3\u7406\uff08\u4f8b\u5982\uff0cRedis\u6216RabbitMQ\uff09\u3002<\/li>\n<li>\u521b\u5efa\u4e00\u4e2aCelery\u5e94\u7528\uff0c\u5e76\u5b9a\u4e49\u60a8\u7684\u4efb\u52a1\u3002<\/li>\n<li>\u542f\u52a8Celery worker\uff0c\u5e76\u53d1\u9001\u4efb\u52a1\u5230\u961f\u5217\u4e2d\u6267\u884c\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>Apache Airflow<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u5b89\u88c5Airflow\u5e76\u914d\u7f6e\u60a8\u7684\u73af\u5883\u3002<\/li>\n<li>\u521b\u5efa\u4e00\u4e2aDAG\uff08\u6709\u5411\u65e0\u73af\u56fe\uff09\uff0c\u5b9a\u4e49\u4efb\u52a1\u548c\u4f9d\u8d56\u5173\u7cfb\u3002<\/li>\n<li>\u542f\u52a8Airflow\u8c03\u5ea6\u5668\u548cweb\u670d\u52a1\u5668\uff0c\u76d1\u63a7\u4efb\u52a1\u6267\u884c\u60c5\u51b5\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>Jenkins<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u5b89\u88c5Jenkins\u5e76\u914d\u7f6e\u60a8\u7684\u73af\u5883\u3002<\/li>\n<li>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Jenkins\u4efb\u52a1\uff0c\u9009\u62e9\u201c\u6784\u5efa\u4e00\u4e2a\u81ea\u7531\u98ce\u683c\u7684\u8f6f\u4ef6\u9879\u76ee\u201d\u3002<\/li>\n<li>\u5728\u6784\u5efa\u6b65\u9aa4\u4e2d\uff0c\u6dfb\u52a0\u4e00\u4e2a\u201c\u6267\u884cShell\u547d\u4ee4\u201d\u6b65\u9aa4\uff0c\u8f93\u5165\u8fd0\u884cPython\u811a\u672c\u7684\u547d\u4ee4\u3002<\/li>\n<li>\u4fdd\u5b58\u5e76\u8fd0\u884c\u4efb\u52a1\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><p>\u516b\u3001\u8c03\u8bd5\u548c\u6392\u9664\u95ee\u9898<\/p>\n<\/p>\n<p><p>\u65e0\u8bba\u60a8\u9009\u62e9\u54ea\u79cd\u65b9\u6cd5\u8fd0\u884cPython\u6587\u4ef6\uff0c\u90fd\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u95ee\u9898\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u95ee\u9898\u53ca\u5176\u89e3\u51b3\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u8def\u5f84\u95ee\u9898<\/strong><\/p>\n<\/p>\n<p><p> \u786e\u4fdd\u60a8\u7684Python\u811a\u672c\u548c\u4f9d\u8d56\u6587\u4ef6\u7684\u8def\u5f84\u6b63\u786e\u3002\u5982\u679c\u811a\u672c\u65e0\u6cd5\u627e\u5230\u67d0\u4e9b\u6587\u4ef6\u6216\u6a21\u5757\uff0c\u53ef\u80fd\u662f\u8def\u5f84\u8bbe\u7f6e\u6709\u8bef\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f9d\u8d56\u95ee\u9898<\/strong><\/p>\n<\/p>\n<p><p> \u786e\u4fdd\u60a8\u5df2\u5b89\u88c5\u6240\u6709\u5fc5\u9700\u7684Python\u5305\u548c\u4f9d\u8d56\u9879\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528 <code>pip list<\/code> \u547d\u4ee4\u68c0\u67e5\u5df2\u5b89\u88c5\u7684\u5305\uff0c\u4f7f\u7528 <code>pip install package_name<\/code> \u547d\u4ee4\u5b89\u88c5\u7f3a\u5931\u7684\u5305\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6743\u9650\u95ee\u9898<\/strong><\/p>\n<\/p>\n<p><p> \u5982\u679c\u60a8\u7684Python\u811a\u672c\u9700\u8981\u8bbf\u95ee\u67d0\u4e9b\u7cfb\u7edf\u8d44\u6e90\uff08\u4f8b\u5982\uff0c\u6587\u4ef6\u3001\u7f51\u7edc\uff09\uff0c\u786e\u4fdd\u60a8\u6709\u9002\u5f53\u7684\u6743\u9650\u3002\u4f8b\u5982\uff0c\u5728Linux\u4e2d\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u4f7f\u7528 <code>sudo<\/code> \u547d\u4ee4\u6765\u63d0\u5347\u6743\u9650\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u73af\u5883\u95ee\u9898<\/strong><\/p>\n<\/p>\n<p><p> \u786e\u4fdd\u60a8\u7684Python\u73af\u5883\u6b63\u786e\u914d\u7f6e\u3002\u5982\u679c\u60a8\u4f7f\u7528\u865a\u62df\u73af\u5883\uff08\u4f8b\u5982\uff0cvenv\u3001virtualenv\uff09\uff0c\u786e\u4fdd\u5df2\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u5e76\u5b89\u88c5\u6240\u6709\u4f9d\u8d56\u9879\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u603b\u7ed3<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u4e0a\u8ff0\u65b9\u6cd5\uff0c\u60a8\u53ef\u4ee5\u8f7b\u677e\u5730\u518d\u6b21\u8fd0\u884c\u4fdd\u5b58\u540e\u7684Python\u6587\u4ef6\u3002\u65e0\u8bba\u662f\u901a\u8fc7\u547d\u4ee4\u884c\u3001IDE\u3001\u4efb\u52a1\u8c03\u5ea6\u5668\u3001Docker\u3001\u4e91\u670d\u52a1\u8fd8\u662f\u7b2c\u4e09\u65b9\u5de5\u5177\uff0c\u9009\u62e9\u6700\u9002\u5408\u60a8\u9700\u6c42\u7684\u65b9\u6cd5\uff0c\u5e76\u6839\u636e\u5177\u4f53\u60c5\u51b5\u8fdb\u884c\u914d\u7f6e\u548c\u8c03\u8bd5\u3002\u5e0c\u671b\u672c\u6587\u80fd\u591f\u5e2e\u52a9\u60a8\u66f4\u597d\u5730\u7ba1\u7406\u548c\u8fd0\u884cPython\u811a\u672c\uff0c\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u548c\u5de5\u4f5c\u6d41\u7684\u987a\u7545\u6027\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5728Python\u4e2d\u4fdd\u5b58\u7684\u6587\u4ef6\u53ef\u4ee5\u901a\u8fc7\u4ec0\u4e48\u65b9\u5f0f\u518d\u6b21\u8fd0\u884c\uff1f<\/strong><br \/>\u8981\u91cd\u65b0\u8fd0\u884c\u4fdd\u5b58\u7684Python\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u884c\u6216\u7ec8\u7aef\u3002\u53ea\u9700\u5bfc\u822a\u5230\u6587\u4ef6\u6240\u5728\u7684\u76ee\u5f55\uff0c\u5e76\u4f7f\u7528\u547d\u4ee4 <code>python \u6587\u4ef6\u540d.py<\/code> \u6765\u6267\u884c\u8be5\u6587\u4ef6\u3002\u5982\u679c\u4f60\u5728\u4f7f\u7528Python 3\uff0c\u8bf7\u786e\u4fdd\u4f7f\u7528 <code>python3 \u6587\u4ef6\u540d.py<\/code> \u6765\u786e\u4fdd\u6b63\u786e\u7684Python\u7248\u672c\u88ab\u8c03\u7528\u3002<\/p>\n<p><strong>\u5728\u8fd0\u884cPython\u6587\u4ef6\u65f6\uff0c\u5982\u4f55\u5904\u7406\u4f9d\u8d56\u5e93\u548c\u6a21\u5757\uff1f<\/strong><br \/>\u5982\u679c\u4fdd\u5b58\u7684Python\u6587\u4ef6\u4f9d\u8d56\u4e8e\u67d0\u4e9b\u5916\u90e8\u5e93\u6216\u6a21\u5757\uff0c\u786e\u4fdd\u5728\u8fd0\u884c\u4e4b\u524d\u5df2\u7ecf\u5b89\u88c5\u8fd9\u4e9b\u4f9d\u8d56\u3002\u53ef\u4ee5\u4f7f\u7528 <code>pip install \u5e93\u540d<\/code> \u547d\u4ee4\u5b89\u88c5\u6240\u9700\u7684\u5e93\u3002\u5982\u679c\u6587\u4ef6\u4f7f\u7528\u7684\u662f\u865a\u62df\u73af\u5883\uff0c\u786e\u4fdd\u5728\u6fc0\u6d3b\u8be5\u73af\u5883\u540e\u6267\u884c\u8fd0\u884c\u547d\u4ee4\u3002<\/p>\n<p><strong>\u5728IDE\u4e2d\u8fd0\u884c\u4fdd\u5b58\u7684Python\u6587\u4ef6\u6709\u4ec0\u4e48\u4f18\u52bf\uff1f<\/strong><br \/>\u4f7f\u7528\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u5982PyCharm\u6216VS Code\uff0c\u53ef\u4ee5\u66f4\u8f7b\u677e\u5730\u8fd0\u884c\u4fdd\u5b58\u7684Python\u6587\u4ef6\u3002\u8fd9\u4e9bIDE\u63d0\u4f9b\u4e86\u56fe\u5f62\u754c\u9762\uff0c\u53ef\u4ee5\u76f4\u63a5\u70b9\u51fb\u201c\u8fd0\u884c\u201d\u6309\u94ae\uff0c\u67e5\u770b\u8f93\u51fa\u548c\u8c03\u8bd5\u4fe1\u606f\uff0c\u540c\u65f6\u8fd8\u652f\u6301\u4ee3\u7801\u8865\u5168\u548c\u9519\u8bef\u63d0\u793a\uff0c\u63d0\u5347\u5f00\u53d1\u6548\u7387\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u4fdd\u5b58\u540e\u7684\u6587\u4ef6\u5982\u4f55\u518d\u6b21\u8fd0\u884c \u5f53\u6211\u4eec\u4f7f\u7528Python\u7f16\u5199\u5e76\u4fdd\u5b58\u4e00\u4e2a\u811a\u672c\u6587\u4ef6\u540e\uff0c\u901a\u5e38\u4f1a\u5e0c\u671b\u80fd\u591f\u518d\u6b21\u8fd0\u884c\u8fd9 [&hellip;]","protected":false},"author":3,"featured_media":1095128,"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\/1095122"}],"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=1095122"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1095122\/revisions"}],"predecessor-version":[{"id":1095130,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1095122\/revisions\/1095130"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1095128"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1095122"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1095122"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1095122"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}