{"id":968964,"date":"2024-12-27T05:12:02","date_gmt":"2024-12-26T21:12:02","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/968964.html"},"modified":"2024-12-27T05:12:04","modified_gmt":"2024-12-26T21:12:04","slug":"%e8%85%be%e8%ae%af%e4%ba%91%e5%a6%82%e4%bd%95%e9%83%a8%e7%bd%b2python","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/968964.html","title":{"rendered":"\u817e\u8baf\u4e91\u5982\u4f55\u90e8\u7f72python"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24183452\/6800b418-89af-481a-bbc9-cf467bef531c.webp\" alt=\"\u817e\u8baf\u4e91\u5982\u4f55\u90e8\u7f72python\" \/><\/p>\n<p><p> <strong>\u8981\u5728\u817e\u8baf\u4e91\u4e0a\u90e8\u7f72Python\u5e94\u7528\u7a0b\u5e8f\uff0c\u60a8\u53ef\u4ee5\u9009\u62e9\u4f7f\u7528\u4e91\u670d\u52a1\u5668\u3001\u65e0\u670d\u52a1\u5668\u51fd\u6570\u6216\u5bb9\u5668\u670d\u52a1\u3002\u6bcf\u79cd\u65b9\u5f0f\u90fd\u6709\u5176\u4f18\u70b9\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u60a8\u7684\u9700\u6c42\u548c\u9879\u76ee\u89c4\u6a21\u3002<\/strong> \u4e91\u670d\u52a1\u5668\u4e3a\u60a8\u63d0\u4f9b\u6700\u5927\u7684\u63a7\u5236\u548c\u7075\u6d3b\u6027\u3001\u65e0\u670d\u52a1\u5668\u51fd\u6570\u9002\u5408\u4e8b\u4ef6\u9a71\u52a8\u7684\u5e94\u7528\u7a0b\u5e8f\u3001\u5bb9\u5668\u670d\u52a1\u5219\u65b9\u4fbf\u5e94\u7528\u7a0b\u5e8f\u7684\u5feb\u901f\u6269\u5c55\u548c\u7ba1\u7406\u3002\u4ee5\u4e0b\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u901a\u8fc7\u8fd9\u4e09\u79cd\u65b9\u5f0f\u5728\u817e\u8baf\u4e91\u4e0a\u90e8\u7f72Python\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u4f7f\u7528\u4e91\u670d\u52a1\u5668\uff08CVM\uff09\u90e8\u7f72Python<\/p>\n<\/p>\n<p><p>\u817e\u8baf\u4e91\u7684\u4e91\u670d\u52a1\u5668\uff08Cloud Virtual Machine, CVM\uff09\u63d0\u4f9b\u4e86\u4e00\u4e2a\u9ad8\u6027\u80fd\u7684\u8ba1\u7b97\u73af\u5883\uff0c\u53ef\u4ee5\u7075\u6d3b\u914d\u7f6e\u548c\u7ba1\u7406\u670d\u52a1\u5668\u8d44\u6e90\uff0c\u9002\u5408\u9700\u8981\u5b9a\u5236\u5316\u90e8\u7f72\u548c\u6301\u7eed\u8fd0\u884c\u7684Python\u5e94\u7528\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u521b\u5efa\u548c\u914d\u7f6e\u4e91\u670d\u52a1\u5668<\/strong><\/p>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u767b\u5f55\u817e\u8baf\u4e91\u5b98\u7f51\uff0c\u8fdb\u5165\u4e91\u670d\u52a1\u5668CVM\u63a7\u5236\u53f0\u3002\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5b9e\u4f8b\uff0c\u9009\u62e9\u5408\u9002\u7684\u914d\u7f6e\u548c\u64cd\u4f5c\u7cfb\u7edf\uff08\u5efa\u8bae\u4f7f\u7528Ubuntu\u6216CentOS\uff09\u3002\u5b8c\u6210\u5b9e\u4f8b\u521b\u5efa\u540e\uff0c\u83b7\u53d6\u5b9e\u4f8b\u7684\u516c\u7f51IP\u5730\u5740\uff0c\u4ee5\u4fbf\u540e\u7eedSSH\u8fde\u63a5\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5\u6240\u9700\u7684\u8f6f\u4ef6<\/strong><\/p>\n<\/p>\n<p><p>\u901a\u8fc7SSH\u8fde\u63a5\u5230\u4e91\u670d\u52a1\u5668\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u66f4\u65b0\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668\u5e76\u5b89\u88c5Python\u548cpip\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt-get update<\/p>\n<p>sudo apt-get install python3 python3-pip<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u9700\u8981\u7279\u5b9a\u7684Python\u7248\u672c\uff0c\u53ef\u4ee5\u4f7f\u7528pyenv\u6765\u7ba1\u7406\u4e0d\u540c\u7248\u672c\u7684Python\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4e0a\u4f20\u5e76\u914d\u7f6e\u5e94\u7528\u7a0b\u5e8f<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528SCP\u6216FTP\u5de5\u5177\u5c06\u672c\u5730\u7684Python\u5e94\u7528\u7a0b\u5e8f\u4e0a\u4f20\u5230\u4e91\u670d\u52a1\u5668\u3002\u5efa\u8bae\u5c06\u5e94\u7528\u7a0b\u5e8f\u653e\u5728\u4e00\u4e2a\u4e13\u95e8\u7684\u76ee\u5f55\u4e0b\uff0c\u5e76\u4f7f\u7528<code>virtualenv<\/code>\u521b\u5efa\u4e00\u4e2a\u865a\u62df\u73af\u5883\u6765\u9694\u79bb\u9879\u76ee\u4f9d\u8d56\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt-get install python3-venv<\/p>\n<p>python3 -m venv myenv<\/p>\n<p>source myenv\/bin\/activate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u540e\uff0c\u4f7f\u7528pip\u5b89\u88c5\u9879\u76ee\u4f9d\u8d56\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install -r requirements.txt<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u914d\u7f6eWeb\u670d\u52a1\u5668\u548c\u53cd\u5411\u4ee3\u7406<\/strong><\/p>\n<\/p>\n<p><p>\u5bf9\u4e8eWeb\u5e94\u7528\u7a0b\u5e8f\uff0c\u53ef\u4ee5\u4f7f\u7528Nginx\u4f5c\u4e3aWeb\u670d\u52a1\u5668\u548c\u53cd\u5411\u4ee3\u7406\u3002\u5b89\u88c5Nginx\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt-get install nginx<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u914d\u7f6eNginx\u4ee5\u4ee3\u7406\u8bf7\u6c42\u5230\u60a8\u7684Python\u5e94\u7528\u7a0b\u5e8f\u3002\u7f16\u8f91<code>\/etc\/nginx\/sites-av<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>lable\/default<\/code>\u6587\u4ef6\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-nginx\">server {<\/p>\n<p>    listen 80;<\/p>\n<p>    server_name your_domain_or_IP;<\/p>\n<p>    location \/ {<\/p>\n<p>        proxy_pass http:\/\/localhost:8000;<\/p>\n<p>        proxy_set_header Host $host;<\/p>\n<p>        proxy_set_header X-Real-IP $remote_addr;<\/p>\n<p>        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<\/p>\n<p>        proxy_set_header X-Forwarded-Proto $scheme;<\/p>\n<p>    }<\/p>\n<p>}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u91cd\u542fNginx\u4ee5\u5e94\u7528\u66f4\u6539\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo systemctl restart nginx<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528Gunicorn\u6216\u5176\u4ed6WSGI\u670d\u52a1\u5668\u8fd0\u884c\u60a8\u7684Python\u5e94\u7528\u7a0b\u5e8f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">gunicorn --bind 0.0.0.0:8000 myapp:app<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5176\u4e2d<code>myapp:app<\/code>\u662f\u6307\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u5165\u53e3\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e8c\u3001\u4f7f\u7528\u65e0\u670d\u52a1\u5668\u51fd\u6570\uff08SCF\uff09\u90e8\u7f72Python<\/p>\n<\/p>\n<p><p>\u817e\u8baf\u4e91\u7684Serverless Cloud Function\uff08SCF\uff09\u9002\u5408\u5c0f\u578b\u5e94\u7528\u6216\u4e8b\u4ef6\u9a71\u52a8\u7684\u573a\u666f\uff0c\u65e0\u9700\u7ba1\u7406\u670d\u52a1\u5668\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u521b\u5efa\u51fd\u6570<\/strong><\/p>\n<\/p>\n<p><p>\u767b\u5f55\u817e\u8baf\u4e91\u63a7\u5236\u53f0\uff0c\u8fdb\u5165\u65e0\u670d\u52a1\u5668\u51fd\u6570SCF\u9875\u9762\uff0c\u70b9\u51fb\u201c\u521b\u5efa\u51fd\u6570\u201d\u3002\u9009\u62e9\u201c\u81ea\u5b9a\u4e49\u521b\u5efa\u201d\uff0c\u5e76\u9009\u62e9Python\u4f5c\u4e3a\u8fd0\u884c\u73af\u5883\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4e0a\u4f20\u4ee3\u7801<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u51fd\u6570\u4ee3\u7801\u7f16\u8f91\u5668\u4e2d\u4e0a\u4f20\u60a8\u7684Python\u4ee3\u7801\u3002\u60a8\u53ef\u4ee5\u76f4\u63a5\u7c98\u8d34\u4ee3\u7801\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u538b\u7f29\u5305\u4e0a\u4f20\u3002\u786e\u4fdd\u5165\u53e3\u51fd\u6570\u7684\u5b9a\u4e49\u4e0e\u914d\u7f6e\u4e00\u81f4\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u914d\u7f6e\u89e6\u53d1\u5668<\/strong><\/p>\n<\/p>\n<p><p>\u6839\u636e\u5e94\u7528\u9700\u6c42\u914d\u7f6e\u89e6\u53d1\u5668\uff0c\u5982HTTP\u89e6\u53d1\u5668\u3001\u5b9a\u65f6\u89e6\u53d1\u5668\u7b49\u3002\u914d\u7f6e\u5b8c\u6210\u540e\uff0cSCF\u5c06\u6839\u636e\u89e6\u53d1\u6761\u4ef6\u81ea\u52a8\u6267\u884c\u60a8\u7684\u51fd\u6570\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6d4b\u8bd5\u548c\u76d1\u63a7<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528\u817e\u8baf\u4e91SCF\u63d0\u4f9b\u7684\u6d4b\u8bd5\u529f\u80fd\u6765\u9a8c\u8bc1\u51fd\u6570\u7684\u8fd0\u884c\u60c5\u51b5\u3002SCF\u8fd8\u63d0\u4f9b\u4e30\u5bcc\u7684\u65e5\u5fd7\u548c\u76d1\u63a7\u529f\u80fd\uff0c\u5e2e\u52a9\u60a8\u5b9e\u65f6\u67e5\u770b\u51fd\u6570\u7684\u6267\u884c\u60c5\u51b5\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001\u4f7f\u7528\u5bb9\u5668\u670d\u52a1\uff08TKE\uff09\u90e8\u7f72Python<\/p>\n<\/p>\n<p><p>\u817e\u8baf\u4e91Kubernetes Engine\uff08TKE\uff09\u662f\u4e00\u4e2a\u6258\u7ba1\u7684Kubernetes\u670d\u52a1\uff0c\u9002\u5408\u9700\u8981\u5feb\u901f\u6269\u5c55\u548c\u9ad8\u53ef\u7528\u6027\u7684\u5e94\u7528\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u521b\u5efaKubernetes\u96c6\u7fa4<\/strong><\/p>\n<\/p>\n<p><p>\u767b\u5f55\u817e\u8baf\u4e91\u63a7\u5236\u53f0\uff0c\u8fdb\u5165TKE\u9875\u9762\uff0c\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Kubernetes\u96c6\u7fa4\u3002\u9009\u62e9\u5408\u9002\u7684\u8282\u70b9\u89c4\u683c\u548c\u7f51\u7edc\u914d\u7f6e\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6784\u5efaDocker\u955c\u50cf<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u672c\u5730\u5f00\u53d1\u73af\u5883\u4e2d\uff0c\u7f16\u5199Dockerfile\u4ee5\u6784\u5efaPython\u5e94\u7528\u7a0b\u5e8f\u7684Docker\u955c\u50cf\u3002\u793a\u4f8bDockerfile\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-dockerfile\">FROM python:3.9-slim<\/p>\n<p>WORKDIR \/app<\/p>\n<p>COPY . \/app<\/p>\n<p>RUN pip install --no-cache-dir -r requirements.txt<\/p>\n<p>CMD [&quot;python&quot;, &quot;app.py&quot;]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4f7f\u7528Docker\u6784\u5efa\u955c\u50cf\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">docker build -t my-python-app .<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u63a8\u9001\u955c\u50cf\u5230\u955c\u50cf\u4ed3\u5e93<\/strong><\/p>\n<\/p>\n<p><p>\u5c06Docker\u955c\u50cf\u63a8\u9001\u5230\u817e\u8baf\u4e91\u5bb9\u5668\u955c\u50cf\u670d\u52a1\uff08CCCR\uff09\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">docker tag my-python-app ccr.ccs.tencentyun.com\/your_namespace\/my-python-app<\/p>\n<p>docker push ccr.ccs.tencentyun.com\/your_namespace\/my-python-app<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u90e8\u7f72\u5230TKE\u96c6\u7fa4<\/strong><\/p>\n<\/p>\n<p><p>\u5728TKE\u63a7\u5236\u53f0\u4e2d\uff0c\u521b\u5efaDeployment\u548cService\u8d44\u6e90\u4ee5\u90e8\u7f72\u5e94\u7528\u3002\u7f16\u5199<code>deployment.yaml<\/code>\u548c<code>service.yaml<\/code>\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-yaml\"># deployment.yaml<\/p>\n<p>apiVersion: apps\/v1<\/p>\n<p>kind: Deployment<\/p>\n<p>metadata:<\/p>\n<p>  name: my-python-app<\/p>\n<p>spec:<\/p>\n<p>  replicas: 3<\/p>\n<p>  selector:<\/p>\n<p>    matchLabels:<\/p>\n<p>      app: my-python-app<\/p>\n<p>  template:<\/p>\n<p>    metadata:<\/p>\n<p>      labels:<\/p>\n<p>        app: my-python-app<\/p>\n<p>    spec:<\/p>\n<p>      containers:<\/p>\n<p>      - name: my-python-app<\/p>\n<p>        image: ccr.ccs.tencentyun.com\/your_namespace\/my-python-app<\/p>\n<p>        ports:<\/p>\n<p>        - containerPort: 80<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><pre><code class=\"language-yaml\"># service.yaml<\/p>\n<p>apiVersion: v1<\/p>\n<p>kind: Service<\/p>\n<p>metadata:<\/p>\n<p>  name: my-python-app<\/p>\n<p>spec:<\/p>\n<p>  type: LoadBalancer<\/p>\n<p>  ports:<\/p>\n<p>  - port: 80<\/p>\n<p>    targetPort: 80<\/p>\n<p>  selector:<\/p>\n<p>    app: my-python-app<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4f7f\u7528kubectl\u5e94\u7528\u8d44\u6e90\u914d\u7f6e\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">kubectl apply -f deployment.yaml<\/p>\n<p>kubectl apply -f service.yaml<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u76d1\u63a7\u548c\u7ba1\u7406<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528TKE\u63d0\u4f9b\u7684\u76d1\u63a7\u548c\u65e5\u5fd7\u529f\u80fd\uff0c\u5b9e\u65f6\u67e5\u770b\u5e94\u7528\u7684\u8fd0\u884c\u72b6\u6001\u548c\u6027\u80fd\u8868\u73b0\u3002\u901a\u8fc7Kubernetes\u7684\u81ea\u52a8\u6269\u5c55\u529f\u80fd\uff0c\u53ef\u4ee5\u6839\u636e\u6d41\u91cf\u9700\u6c42\u52a8\u6001\u8c03\u6574\u5e94\u7528\u7684\u526f\u672c\u6570\u91cf\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u4e09\u79cd\u65b9\u5f0f\uff0c\u60a8\u53ef\u4ee5\u6839\u636e\u9879\u76ee\u9700\u6c42\u5728\u817e\u8baf\u4e91\u4e0a\u7075\u6d3b\u5730\u90e8\u7f72Python\u5e94\u7528\u7a0b\u5e8f\u3002\u65e0\u8bba\u662f\u9700\u8981\u5168\u9762\u63a7\u5236\u7684\u4e91\u670d\u52a1\u5668\u3001\u4e8b\u4ef6\u9a71\u52a8\u7684\u65e0\u670d\u52a1\u5668\u51fd\u6570\uff0c\u8fd8\u662f\u5feb\u901f\u6269\u5c55\u7684\u5bb9\u5668\u670d\u52a1\uff0c\u817e\u8baf\u4e91\u90fd\u80fd\u63d0\u4f9b\u76f8\u5e94\u7684\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728\u817e\u8baf\u4e91\u4e0a\u521b\u5efaPython\u73af\u5883\uff1f<\/strong><br \/>\u5728\u817e\u8baf\u4e91\u4e0a\u521b\u5efaPython\u73af\u5883\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\u8fdb\u884c\u3002\u60a8\u53ef\u4ee5\u9009\u62e9\u4f7f\u7528\u4e91\u670d\u52a1\u5668\uff08CVM\uff09\u642d\u5efa\u81ea\u5b9a\u4e49\u73af\u5883\uff0c\u5b89\u88c5\u6240\u9700\u7684Python\u7248\u672c\u53ca\u76f8\u5173\u5e93\u3002\u4e5f\u53ef\u4ee5\u4f7f\u7528\u817e\u8baf\u4e91\u7684\u5bb9\u5668\u670d\u52a1\uff0c\u901a\u8fc7Docker\u955c\u50cf\u5feb\u901f\u90e8\u7f72Python\u5e94\u7528\u3002\u6b64\u5916\uff0c\u817e\u8baf\u4e91\u7684Serverless Cloud Function\u4e5f\u652f\u6301Python\uff0c\u60a8\u53ea\u9700\u4e0a\u4f20\u4ee3\u7801\uff0c\u5373\u53ef\u81ea\u52a8\u8fd0\u884c\u3002<\/p>\n<p><strong>\u5728\u817e\u8baf\u4e91\u4e0a\u90e8\u7f72Python\u5e94\u7528\u9700\u8981\u54ea\u4e9b\u57fa\u672c\u6b65\u9aa4\uff1f<\/strong><br \/>\u90e8\u7f72Python\u5e94\u7528\u7684\u57fa\u672c\u6b65\u9aa4\u5305\u62ec\uff1a\u9996\u5148\uff0c\u9009\u62e9\u5408\u9002\u7684\u4e91\u4ea7\u54c1\uff08\u5982CVM\u3001\u5bb9\u5668\u670d\u52a1\u6216Serverless\uff09\uff0c\u7136\u540e\u521b\u5efa\u5b9e\u4f8b\u5e76\u914d\u7f6e\u73af\u5883\u3002\u63a5\u4e0b\u6765\uff0c\u60a8\u9700\u8981\u4e0a\u4f20\u4ee3\u7801\u6587\u4ef6\u548c\u76f8\u5173\u4f9d\u8d56\uff0c\u6700\u540e\u901a\u8fc7\u914d\u7f6e\u7f51\u7edc\u548c\u5b89\u5168\u7ec4\u89c4\u5219\uff0c\u786e\u4fdd\u5e94\u7528\u80fd\u591f\u6b63\u5e38\u8bbf\u95ee\u548c\u4f7f\u7528\u3002<\/p>\n<p><strong>\u817e\u8baf\u4e91\u652f\u6301\u54ea\u4e9bPython\u7248\u672c\u548c\u6846\u67b6\uff1f<\/strong><br \/>\u817e\u8baf\u4e91\u652f\u6301\u591a\u79cdPython\u7248\u672c\uff0c\u5305\u62ecPython 2.x\u548cPython 3.x\u3002\u60a8\u53ef\u4ee5\u6839\u636e\u9879\u76ee\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u7248\u672c\u3002\u540c\u65f6\uff0c\u5e38\u89c1\u7684Python\u6846\u67b6\u5982Flask\u3001Django\u548cFastAPI\u7b49\uff0c\u4e5f\u90fd\u53ef\u4ee5\u5728\u817e\u8baf\u4e91\u4e0a\u987a\u5229\u8fd0\u884c\u3002\u786e\u4fdd\u5728\u90e8\u7f72\u524d\u6d4b\u8bd5\u4ee3\u7801\u7684\u517c\u5bb9\u6027\uff0c\u4ee5\u907f\u514d\u8fd0\u884c\u65f6\u9519\u8bef\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u5728\u817e\u8baf\u4e91\u4e0a\u90e8\u7f72Python\u5e94\u7528\u7a0b\u5e8f\uff0c\u60a8\u53ef\u4ee5\u9009\u62e9\u4f7f\u7528\u4e91\u670d\u52a1\u5668\u3001\u65e0\u670d\u52a1\u5668\u51fd\u6570\u6216\u5bb9\u5668\u670d\u52a1\u3002\u6bcf\u79cd\u65b9\u5f0f\u90fd\u6709\u5176\u4f18\u70b9\uff0c\u5177\u4f53 [&hellip;]","protected":false},"author":3,"featured_media":968968,"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\/968964"}],"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=968964"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/968964\/revisions"}],"predecessor-version":[{"id":968972,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/968964\/revisions\/968972"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/968968"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=968964"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=968964"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=968964"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}