{"id":1019109,"date":"2024-12-27T12:50:55","date_gmt":"2024-12-27T04:50:55","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1019109.html"},"modified":"2024-12-27T12:51:05","modified_gmt":"2024-12-27T04:51:05","slug":"cvi%e5%a6%82%e4%bd%95%e8%b0%83%e7%94%a8python%e7%a8%8b%e5%ba%8f","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1019109.html","title":{"rendered":"cvi\u5982\u4f55\u8c03\u7528python\u7a0b\u5e8f"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25161645\/536b4fbf-bba3-4a9b-9752-76f35ad4a8f7.webp\" alt=\"cvi\u5982\u4f55\u8c03\u7528python\u7a0b\u5e8f\" \/><\/p>\n<p><p> \u8c03\u7528Python\u7a0b\u5e8f\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u6cd5\u5b9e\u73b0\uff0c<strong>\u5305\u62ec\u4f7f\u7528\u547d\u4ee4\u884c\u3001\u901a\u8fc7API\u63a5\u53e3\u3001\u5d4c\u5165\u5230\u5176\u4ed6\u7f16\u7a0b\u8bed\u8a00\u4e2d\u3001\u4f7f\u7528Python\u89e3\u91ca\u5668<\/strong>\u3002\u5728\u8fd9\u51e0\u79cd\u65b9\u6cd5\u4e2d\uff0c\u4f7f\u7528\u547d\u4ee4\u884c\u662f\u6700\u76f4\u63a5\u7684\u65b9\u5f0f\uff0c\u800c\u901a\u8fc7API\u63a5\u53e3\u5219\u9002\u5408\u9700\u8981\u5728\u4e0d\u540c\u7cfb\u7edf\u4e4b\u95f4\u8fdb\u884c\u4ea4\u4e92\u7684\u573a\u666f\u3002\u5177\u4f53\u6765\u8bf4\uff0c\u547d\u4ee4\u884c\u8c03\u7528Python\u7a0b\u5e8f\u53ef\u4ee5\u901a\u8fc7\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165<code>python script.py<\/code>\u5b9e\u73b0\uff0c\u8fd9\u79cd\u65b9\u6cd5\u7b80\u5355\u800c\u76f4\u89c2\u3002\u5bf9\u4e8eAPI\u63a5\u53e3\uff0c\u53ef\u4ee5\u4f7f\u7528Flask\u6216Django\u7b49\u6846\u67b6\u521b\u5efa\u4e00\u4e2aWeb\u670d\u52a1\uff0c\u4f7f\u5f97\u5176\u4ed6\u7a0b\u5e8f\u53ef\u4ee5\u901a\u8fc7HTTP\u8bf7\u6c42\u6765\u8c03\u7528Python\u51fd\u6570\u3002\u63a5\u4e0b\u6765\u5c06\u8be6\u7ec6\u63cf\u8ff0\u901a\u8fc7\u547d\u4ee4\u884c\u8c03\u7528Python\u7a0b\u5e8f\u7684\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u547d\u4ee4\u884c\u8c03\u7528Python\u7a0b\u5e8f\u4e0d\u9700\u8981\u590d\u6742\u7684\u8bbe\u7f6e\uff0c\u53ea\u9700\u786e\u4fdd\u4f60\u7684\u7cfb\u7edf\u5df2\u7ecf\u5b89\u88c5\u4e86Python\u73af\u5883\u3002\u5728\u547d\u4ee4\u884c\u4e2d\uff0c\u8fdb\u5165Python\u811a\u672c\u6240\u5728\u7684\u76ee\u5f55\uff0c\u7136\u540e\u8f93\u5165<code>python script.py<\/code>\uff0c\u5176\u4e2d<code>script.py<\/code>\u662f\u4f60\u7684Python\u6587\u4ef6\u540d\u3002\u8fd9\u6837\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884cPython\u7a0b\u5e8f\u5e76\u67e5\u770b\u8f93\u51fa\u7ed3\u679c\u3002\u8fd9\u79cd\u65b9\u6cd5\u7279\u522b\u9002\u5408\u5728\u672c\u5730\u5f00\u53d1\u6d4b\u8bd5\u6216\u8005\u6267\u884c\u7b80\u5355\u7684\u811a\u672c\u4efb\u52a1\u3002\u6b64\u5916\uff0c\u5728\u67d0\u4e9b\u64cd\u4f5c\u7cfb\u7edf\u4e2d\uff0c\u53ef\u80fd\u9700\u8981\u4f7f\u7528<code>python3<\/code>\u547d\u4ee4\u6765\u533a\u5206Python\u7248\u672c\u3002\u5982\u679cPython\u811a\u672c\u9700\u8981\u63a5\u53d7\u547d\u4ee4\u884c\u53c2\u6570\uff0c\u53ef\u4ee5\u5728\u547d\u4ee4\u540e\u9644\u52a0\u53c2\u6570\uff0c\u6bd4\u5982<code>python script.py arg1 arg2<\/code>\uff0c\u5728Python\u811a\u672c\u4e2d\u53ef\u4ee5\u901a\u8fc7<code>sys.argv<\/code>\u5217\u8868\u6765\u8bbf\u95ee\u8fd9\u4e9b\u53c2\u6570\u3002<\/p>\n<\/p>\n<hr>\n<p><h2>\u4e00\u3001\u4f7f\u7528\u547d\u4ee4\u884c\u8c03\u7528Python\u7a0b\u5e8f<\/h2>\n<\/p>\n<p><p>\u5728\u65e5\u5e38\u5f00\u53d1\u4e2d\uff0c\u901a\u8fc7\u547d\u4ee4\u884c\u8c03\u7528Python\u7a0b\u5e8f\u662f\u975e\u5e38\u5e38\u89c1\u7684\u4e00\u79cd\u65b9\u5f0f\u3002\u5b83\u7b80\u5355\u3001\u5feb\u901f\uff0c\u5e76\u4e14\u9002\u7528\u4e8e\u5927\u591a\u6570\u7684\u5f00\u53d1\u73af\u5883\u3002<\/p>\n<\/p>\n<p><h3>1. \u5b89\u88c5Python\u73af\u5883<\/h3>\n<\/p>\n<p><p>\u5728\u5927\u591a\u6570\u64cd\u4f5c\u7cfb\u7edf\u4e2d\uff0cPython\u5df2\u7ecf\u6210\u4e3a\u6807\u51c6\u5b89\u88c5\u7684\u4e00\u90e8\u5206\u3002\u4f46\u5982\u679c\u4f60\u7684\u7cfb\u7edf\u6ca1\u6709\u9884\u88c5Python\uff0c\u4f60\u9700\u8981\u624b\u52a8\u5b89\u88c5\u3002\u53ef\u4ee5\u4ecePython\u7684\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u9002\u5408\u4f60\u64cd\u4f5c\u7cfb\u7edf\u7684\u5b89\u88c5\u5305\uff0c\u5e76\u6309\u7167\u63d0\u793a\u5b8c\u6210\u5b89\u88c5\u3002\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u8bf7\u786e\u4fdd\u5c06Python\u52a0\u5165\u5230\u7cfb\u7edf\u7684\u73af\u5883\u53d8\u91cf\u4e2d\uff0c\u8fd9\u6837\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e2d\u76f4\u63a5\u4f7f\u7528<code>python<\/code>\u547d\u4ee4\u3002<\/p>\n<\/p>\n<p><h3>2. \u7f16\u5199\u5e76\u4fdd\u5b58Python\u811a\u672c<\/h3>\n<\/p>\n<p><p>\u7f16\u5199Python\u811a\u672c\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528\u4efb\u4f55\u6587\u672c\u7f16\u8f91\u5668\uff0c\u5982Notepad++\u3001Sublime Text\u3001Visual Studio Code\u7b49\u3002\u5c06\u4f60\u7684Python\u4ee3\u7801\u4fdd\u5b58\u4e3a<code>.py<\/code>\u6587\u4ef6\u3002\u4f8b\u5982\uff0c\u4f60\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code>hello.py<\/code>\u7684\u6587\u4ef6\uff0c\u5176\u4e2d\u5305\u542b\u4ee5\u4e0b\u4ee3\u7801\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><h3>3. \u8fd0\u884cPython\u811a\u672c<\/h3>\n<\/p>\n<p><p>\u6253\u5f00\u547d\u4ee4\u884c\u6216\u7ec8\u7aef\uff0c\u4f7f\u7528<code>cd<\/code>\u547d\u4ee4\u8fdb\u5165Python\u811a\u672c\u6240\u5728\u7684\u76ee\u5f55\u3002\u7136\u540e\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u8fd0\u884c\u811a\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python hello.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u4f60\u7684\u7cfb\u7edf\u4e0a\u5b89\u88c5\u7684\u662fPython 3.x\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u4f7f\u7528<code>python3<\/code>\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python3 hello.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>4. \u4f20\u9012\u547d\u4ee4\u884c\u53c2\u6570<\/h3>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u5411Python\u811a\u672c\u4f20\u9012\u53c2\u6570\u3002\u8fd9\u53ef\u4ee5\u901a\u8fc7\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165\u53c2\u6570\u7684\u65b9\u5f0f\u5b9e\u73b0\u3002\u4f8b\u5982\uff0c\u5047\u8bbe\u4f60\u6709\u4e00\u4e2a<code>add.py<\/code>\u811a\u672c\uff0c\u5b83\u63a5\u53d7\u4e24\u4e2a\u6570\u5b57\u5e76\u8f93\u51fa\u5b83\u4eec\u7684\u548c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import sys<\/p>\n<p>if len(sys.argv) != 3:<\/p>\n<p>    print(&quot;Usage: python add.py num1 num2&quot;)<\/p>\n<p>    sys.exit(1)<\/p>\n<p>num1 = float(sys.argv[1])<\/p>\n<p>num2 = float(sys.argv[2])<\/p>\n<p>print(f&quot;The sum is: {num1 + num2}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4f60\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u4f20\u9012\u53c2\u6570\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python add.py 4 5<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u8f93\u51fa\uff1a<\/p>\n<\/p>\n<p><pre><code>The sum is: 9.0<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u4e8c\u3001\u901a\u8fc7API\u63a5\u53e3\u8c03\u7528Python\u7a0b\u5e8f<\/h2>\n<\/p>\n<p><p>\u5f53\u9700\u8981\u5728\u4e0d\u540c\u7cfb\u7edf\u6216\u8005\u4e0d\u540c\u8bed\u8a00\u4e4b\u95f4\u8fdb\u884c\u4ea4\u4e92\u65f6\uff0c\u4f7f\u7528API\u63a5\u53e3\u8c03\u7528Python\u7a0b\u5e8f\u662f\u4e00\u79cd\u5e38\u7528\u7684\u65b9\u6cd5\u3002Python\u4e2d\u6709\u8bb8\u591a\u6846\u67b6\u53ef\u4ee5\u5e2e\u52a9\u4f60\u521b\u5efaAPI\u63a5\u53e3\uff0c\u5982Flask\u3001Django\u7b49\u3002<\/p>\n<\/p>\n<p><h3>1. \u4f7f\u7528Flask\u521b\u5efa\u7b80\u5355API<\/h3>\n<\/p>\n<p><p>Flask\u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684Web\u6846\u67b6\uff0c\u975e\u5e38\u9002\u5408\u7528\u6765\u521b\u5efa\u7b80\u5355\u7684API\u63a5\u53e3\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u4f7f\u7528Flask\u521b\u5efaAPI\u63a5\u53e3\u7684\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u5b89\u88c5Flask\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install Flask<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\uff0c\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code>app.py<\/code>\u7684\u6587\u4ef6\uff0c\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from flask import Flask, request, jsonify<\/p>\n<p>app = Flask(__name__)<\/p>\n<p>@app.route(&#39;\/add&#39;, methods=[&#39;GET&#39;])<\/p>\n<p>def add_numbers():<\/p>\n<p>    num1 = request.args.get(&#39;num1&#39;, type=float)<\/p>\n<p>    num2 = request.args.get(&#39;num2&#39;, type=float)<\/p>\n<p>    return jsonify({&#39;result&#39;: num1 + num2})<\/p>\n<p>if __name__ == &#39;__m<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>n__&#39;:<\/p>\n<p>    app.run(debug=True)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u547d\u4ee4\u884c\u4e2d\u8fd0\u884cFlask\u5e94\u7528\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python app.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6b64\u65f6\uff0cFlask\u5e94\u7528\u5c06\u5728\u672c\u5730\u76845000\u7aef\u53e3\u8fd0\u884c\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u6d4f\u89c8\u5668\u6216\u8005\u5176\u4ed6HTTP\u5ba2\u6237\u7aef\u8bbf\u95eeAPI\uff1a<\/p>\n<\/p>\n<p><pre><code>http:\/\/127.0.0.1:5000\/add?num1=4&amp;num2=5<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>2. \u4f7f\u7528Django\u521b\u5efaAPI\u63a5\u53e3<\/h3>\n<\/p>\n<p><p>Django\u662f\u4e00\u79cd\u529f\u80fd\u66f4\u4e3a\u5f3a\u5927\u7684Web\u6846\u67b6\uff0c\u9002\u5408\u521b\u5efa\u590d\u6742\u7684Web\u5e94\u7528\u548cAPI\u63a5\u53e3\u3002\u8981\u5728Django\u4e2d\u521b\u5efaAPI\u63a5\u53e3\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528Django REST framework\u7b49\u63d2\u4ef6\u3002<\/p>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u5b89\u88c5Django\u548cDjango REST framework\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install Django djangorestframework<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u521b\u5efa\u4e00\u4e2aDjango\u9879\u76ee\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">django-admin startproject myproject<\/p>\n<p>cd myproject<\/p>\n<p>python manage.py startapp myapp<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728<code>myapp<\/code>\u76ee\u5f55\u4e0b\u7684<code>views.py<\/code>\u4e2d\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from rest_framework.decorators import api_view<\/p>\n<p>from rest_framework.response import Response<\/p>\n<p>@api_view([&#39;GET&#39;])<\/p>\n<p>def add_numbers(request):<\/p>\n<p>    num1 = float(request.query_params.get(&#39;num1&#39;))<\/p>\n<p>    num2 = float(request.query_params.get(&#39;num2&#39;))<\/p>\n<p>    return Response({&#39;result&#39;: num1 + num2})<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728<code>myproject\/urls.py<\/code>\u4e2d\uff0c\u6dfb\u52a0\u4e00\u4e2aURL\u6620\u5c04\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from django.urls import path<\/p>\n<p>from myapp.views import add_numbers<\/p>\n<p>urlpatterns = [<\/p>\n<p>    path(&#39;add\/&#39;, add_numbers),<\/p>\n<p>]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd0\u884cDjango\u5f00\u53d1\u670d\u52a1\u5668\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python manage.py runserver<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u73b0\u5728\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0bURL\u8bbf\u95eeAPI\u63a5\u53e3\uff1a<\/p>\n<\/p>\n<p><pre><code>http:\/\/127.0.0.1:8000\/add\/?num1=4&amp;num2=5<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u4e09\u3001\u5d4c\u5165\u5230\u5176\u4ed6\u7f16\u7a0b\u8bed\u8a00\u4e2d<\/h2>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u5f00\u53d1\u573a\u666f\u4e2d\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u5728\u5176\u4ed6\u7f16\u7a0b\u8bed\u8a00\u4e2d\u8c03\u7528Python\u4ee3\u7801\u3002\u8fd9\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\u5b9e\u73b0\uff0c\u5305\u62ec\u901a\u8fc7\u7cfb\u7edf\u8c03\u7528\u3001\u4f7f\u7528\u5d4c\u5165\u5f0f\u89e3\u91ca\u5668\u7b49\u3002<\/p>\n<\/p>\n<p><h3>1. \u4f7f\u7528\u7cfb\u7edf\u8c03\u7528<\/h3>\n<\/p>\n<p><p>\u5927\u591a\u6570\u7f16\u7a0b\u8bed\u8a00\u90fd\u63d0\u4f9b\u4e86\u6267\u884c\u7cfb\u7edf\u547d\u4ee4\u7684\u65b9\u5f0f\uff0c\u56e0\u6b64\u53ef\u4ee5\u901a\u8fc7\u7cfb\u7edf\u8c03\u7528\u6765\u8fd0\u884cPython\u811a\u672c\u3002\u4f8b\u5982\uff0c\u5728C\u8bed\u8a00\u4e2d\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528<code>system<\/code>\u51fd\u6570\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-c\">#include &lt;stdlib.h&gt;<\/p>\n<p>int main() {<\/p>\n<p>    system(&quot;python hello.py&quot;);<\/p>\n<p>    return 0;<\/p>\n<p>}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728Java\u4e2d\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528<code>Runtime<\/code>\u7c7b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-java\">import java.io.IOException;<\/p>\n<p>public class Main {<\/p>\n<p>    public static void main(String[] args) {<\/p>\n<p>        try {<\/p>\n<p>            Runtime.getRuntime().exec(&quot;python hello.py&quot;);<\/p>\n<p>        } catch (IOException e) {<\/p>\n<p>            e.printStackTrace();<\/p>\n<p>        }<\/p>\n<p>    }<\/p>\n<p>}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>2. \u4f7f\u7528\u5d4c\u5165\u5f0f\u89e3\u91ca\u5668<\/h3>\n<\/p>\n<p><p>\u4e00\u4e9b\u7f16\u7a0b\u8bed\u8a00\u5141\u8bb8\u5d4c\u5165Python\u89e3\u91ca\u5668\uff0c\u4ece\u800c\u53ef\u4ee5\u76f4\u63a5\u5728\u4ee3\u7801\u4e2d\u8c03\u7528Python\u51fd\u6570\u3002\u4f8b\u5982\uff0c\u5728C\/C++\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528Python\u63d0\u4f9b\u7684C API\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-c\">#include &lt;Python.h&gt;<\/p>\n<p>int main() {<\/p>\n<p>    Py_Initialize();<\/p>\n<p>    PyRun_SimpleString(&quot;print(&#39;Hello from embedded Python&#39;)&quot;);<\/p>\n<p>    Py_Finalize();<\/p>\n<p>    return 0;<\/p>\n<p>}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728.NET\u5e73\u53f0\u4e0a\uff0c\u53ef\u4ee5\u4f7f\u7528IronPython\uff0c\u5b83\u662f\u4e00\u4e2a\u9488\u5bf9.NET\u6846\u67b6\u7684Python\u5b9e\u73b0\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-csharp\">using System;<\/p>\n<p>using IronPython.Hosting;<\/p>\n<p>using Microsoft.Scripting.Hosting;<\/p>\n<p>public class MainClass {<\/p>\n<p>    public static void Main(string[] args) {<\/p>\n<p>        ScriptEngine engine = Python.CreateEngine();<\/p>\n<p>        engine.Execute(&quot;print(&#39;Hello from IronPython&#39;)&quot;);<\/p>\n<p>    }<\/p>\n<p>}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u56db\u3001\u4f7f\u7528Python\u89e3\u91ca\u5668<\/h2>\n<\/p>\n<p><p>Python\u89e3\u91ca\u5668\u672c\u8eab\u4e5f\u53ef\u4ee5\u7528\u6765\u6267\u884cPython\u4ee3\u7801\uff0c\u5e76\u4e14\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\u8fdb\u884c\u8c03\u7528\u3002 <\/p>\n<\/p>\n<p><h3>1. \u76f4\u63a5\u5728\u89e3\u91ca\u5668\u4e2d\u6267\u884c\u4ee3\u7801<\/h3>\n<\/p>\n<p><p>Python\u89e3\u91ca\u5668\u53ef\u4ee5\u76f4\u63a5\u6267\u884cPython\u4ee3\u7801\u7247\u6bb5\u3002\u4f60\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e2d\u542f\u52a8Python\u89e3\u91ca\u5668\uff0c\u7136\u540e\u76f4\u63a5\u8f93\u5165Python\u4ee3\u7801\u8fdb\u884c\u6267\u884c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fdb\u5165Python\u89e3\u91ca\u5668\u540e\uff0c\u4f60\u53ef\u4ee5\u8f93\u5165\u4efb\u610f\u7684Python\u4ee3\u7801\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">&gt;&gt;&gt; print(&quot;Hello, World!&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>2. \u4f7f\u7528\u4ea4\u4e92\u5f0f\u89e3\u91ca\u5668<\/h3>\n<\/p>\n<p><p>\u5bf9\u4e8e\u9700\u8981\u4ea4\u4e92\u5f0f\u6267\u884cPython\u4ee3\u7801\u7684\u573a\u666f\uff0c\u53ef\u4ee5\u4f7f\u7528IPython\u6216Jupyter Notebook\u3002\u8fd9\u4e9b\u5de5\u5177\u63d0\u4f9b\u4e86\u66f4\u5f3a\u5927\u7684\u4ea4\u4e92\u529f\u80fd\u548c\u66f4\u597d\u7684\u7528\u6237\u4f53\u9a8c\u3002<\/p>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u5b89\u88c5IPython\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install ipython<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\uff0c\u8fd0\u884cIPython\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">ipython<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>IPython\u63d0\u4f9b\u4e86\u8bb8\u591a\u589e\u5f3a\u529f\u80fd\uff0c\u5982\u81ea\u52a8\u8865\u5168\u3001\u8bed\u6cd5\u9ad8\u4eae\u7b49\u3002\u4f60\u53ef\u4ee5\u5728IPython\u4e2d\u8f93\u5165\u5e76\u6267\u884cPython\u4ee3\u7801\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">In [1]: print(&quot;Hello, World!&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5bf9\u4e8e\u9700\u8981\u8fdb\u884c\u6570\u636e\u5206\u6790\u548c\u53ef\u89c6\u5316\u7684\u573a\u666f\uff0cJupyter Notebook\u662f\u4e00\u4e2a\u975e\u5e38\u6709\u7528\u7684\u5de5\u5177\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\u5e76\u8fd0\u884cJupyter Notebook\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install jupyter<\/p>\n<p>jupyter notebook<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u5728\u6d4f\u89c8\u5668\u4e2d\u6253\u5f00\u4e00\u4e2a\u65b0\u7684\u7a97\u53e3\uff0c\u4f60\u53ef\u4ee5\u5728\u5176\u4e2d\u521b\u5efa\u548c\u6267\u884cPython\u4ee3\u7801\u5355\u5143\uff0c\u5e76\u67e5\u770b\u8f93\u51fa\u7ed3\u679c\u3002<\/p>\n<\/p>\n<p><h2>\u4e94\u3001\u901a\u8fc7\u5916\u90e8\u5de5\u5177\u548c\u5e93\u8c03\u7528Python\u7a0b\u5e8f<\/h2>\n<\/p>\n<p><p>\u9664\u4e86\u76f4\u63a5\u8c03\u7528Python\u7a0b\u5e8f\u5916\uff0c\u8bb8\u591a\u5916\u90e8\u5de5\u5177\u548c\u5e93\u4e5f\u63d0\u4f9b\u4e86\u8c03\u7528Python\u7a0b\u5e8f\u7684\u529f\u80fd\u3002\u8fd9\u4e9b\u5de5\u5177\u548c\u5e93\u901a\u5e38\u7528\u4e8e\u5728\u7279\u5b9a\u9886\u57df\u8fdb\u884c\u6570\u636e\u5904\u7406\u548c\u5206\u6790\u3002<\/p>\n<\/p>\n<p><h3>1. \u4f7f\u7528Apache Airflow\u8fdb\u884c\u4efb\u52a1\u8c03\u5ea6<\/h3>\n<\/p>\n<p><p>Apache Airflow\u662f\u4e00\u4e2a\u7528\u4e8e\u7f16\u6392\u548c\u8c03\u5ea6\u590d\u6742\u4efb\u52a1\u7684\u5de5\u5177\u3002\u5b83\u5141\u8bb8\u4f60\u5b9a\u4e49\u4efb\u52a1\u7684\u4f9d\u8d56\u5173\u7cfb\uff0c\u5e76\u901a\u8fc7Python\u811a\u672c\u6765\u6267\u884c\u8fd9\u4e9b\u4efb\u52a1\u3002<\/p>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u5b89\u88c5Airflow\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install apache-airflow<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\uff0c\u521b\u5efa\u4e00\u4e2aDAG\uff08\u6709\u5411\u65e0\u73af\u56fe\uff09\u6587\u4ef6\uff0c\u5b9a\u4e49\u4f60\u7684\u4efb\u52a1\u6d41\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from airflow import DAG<\/p>\n<p>from airflow.operators.python_operator import PythonOperator<\/p>\n<p>from datetime import datetime<\/p>\n<p>def print_hello():<\/p>\n<p>    print(&#39;Hello from Airflow!&#39;)<\/p>\n<p>dag = DAG(&#39;hello_world&#39;, description=&#39;Simple hello world DAG&#39;,<\/p>\n<p>          schedule_interval=&#39;0 12 * * *&#39;,<\/p>\n<p>          start_date=datetime(2023, 1, 1), catchup=False)<\/p>\n<p>hello_operator = PythonOperator(task_id=&#39;hello_task&#39;, python_callable=print_hello, dag=dag)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>2. \u4f7f\u7528Luigi\u8fdb\u884c\u7ba1\u9053\u7ba1\u7406<\/h3>\n<\/p>\n<p><p>Luigi\u662f\u4e00\u4e2a\u7528\u4e8e\u6784\u5efa\u6279\u5904\u7406\u6570\u636e\u7ba1\u9053\u7684Python\u5e93\u3002\u5b83\u4e0eAirflow\u7c7b\u4f3c\uff0c\u4f46\u66f4\u8f7b\u91cf\u7ea7\uff0c\u9002\u5408\u4e8e\u7b80\u5355\u7684\u6570\u636e\u5904\u7406\u4efb\u52a1\u3002<\/p>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u5b89\u88c5Luigi\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install luigi<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u521b\u5efa\u4e00\u4e2aLuigi\u4efb\u52a1\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import luigi<\/p>\n<p>class HelloWorldTask(luigi.Task):<\/p>\n<p>    def output(self):<\/p>\n<p>        return luigi.LocalTarget(&#39;hello.txt&#39;)<\/p>\n<p>    def run(self):<\/p>\n<p>        with self.output().open(&#39;w&#39;) as f:<\/p>\n<p>            f.write(&#39;Hello from Luigi!\\n&#39;)<\/p>\n<p>if __name__ == &#39;__main__&#39;:<\/p>\n<p>    luigi.run([&#39;HelloWorldTask&#39;])<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u547d\u4ee4\u884c\u8fd0\u884cLuigi\u4efb\u52a1\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python hello_luigi.py --local-scheduler<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u516d\u3001\u901a\u8fc7\u5bb9\u5668\u5316\u6280\u672f\u8c03\u7528Python\u7a0b\u5e8f<\/h2>\n<\/p>\n<p><p>\u5bb9\u5668\u5316\u6280\u672f\u5982Docker\u4f7f\u5f97\u5728\u4e0d\u540c\u73af\u5883\u4e2d\u8c03\u7528\u548c\u8fd0\u884cPython\u7a0b\u5e8f\u53d8\u5f97\u66f4\u52a0\u5bb9\u6613\u3002\u4f60\u53ef\u4ee5\u5c06Python\u7a0b\u5e8f\u6253\u5305\u4e3aDocker\u5bb9\u5668\uff0c\u5e76\u5728\u4efb\u4f55\u652f\u6301Docker\u7684\u73af\u5883\u4e2d\u8fd0\u884c\u3002<\/p>\n<\/p>\n<p><h3>1. \u521b\u5efaDocker\u955c\u50cf<\/h3>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u521b\u5efa\u4e00\u4e2a\u5305\u542bPython\u7a0b\u5e8f\u7684\u76ee\u5f55\uff0c\u5e76\u5728\u5176\u4e2d\u521b\u5efa\u4e00\u4e2aDockerfile\u3002\u4f8b\u5982\uff0c\u76ee\u5f55\u7ed3\u6784\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code>\/my-python-app<\/p>\n<p>  |-- app.py<\/p>\n<p>  |-- Dockerfile<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728<code>app.py<\/code>\u4e2d\u7f16\u5199Python\u4ee3\u7801\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">print(&quot;Hello from Docker!&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728Dockerfile\u4e2d\u5b9a\u4e49\u955c\u50cf\u6784\u5efa\u6b65\u9aa4\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.py .<\/p>\n<p>CMD [&quot;python&quot;, &quot;app.py&quot;]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>2. \u6784\u5efa\u548c\u8fd0\u884cDocker\u5bb9\u5668<\/h3>\n<\/p>\n<p><p>\u5728<code>my-python-app<\/code>\u76ee\u5f55\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u6784\u5efaDocker\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<p><p>\u7136\u540e\uff0c\u8fd0\u884cDocker\u5bb9\u5668\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">docker run my-python-app<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u8f93\u51fa\uff1a<\/p>\n<\/p>\n<p><pre><code>Hello from Docker!<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u4f7f\u7528\u5bb9\u5668\u5316\u6280\u672f\uff0c\u4f60\u53ef\u4ee5\u8f7b\u677e\u5730\u5728\u4e0d\u540c\u73af\u5883\u4e2d\u90e8\u7f72\u548c\u8fd0\u884cPython\u7a0b\u5e8f\uff0c\u800c\u4e0d\u5fc5\u62c5\u5fc3\u73af\u5883\u914d\u7f6e\u548c\u4f9d\u8d56\u95ee\u9898\u3002<\/p>\n<\/p>\n<p><h2>\u4e03\u3001\u901a\u8fc7\u4e91\u8ba1\u7b97\u5e73\u53f0\u8c03\u7528Python\u7a0b\u5e8f<\/h2>\n<\/p>\n<p><p>\u73b0\u4ee3\u4e91\u8ba1\u7b97\u5e73\u53f0\u63d0\u4f9b\u4e86\u591a\u79cd\u65b9\u5f0f\u6765\u90e8\u7f72\u548c\u8fd0\u884cPython\u7a0b\u5e8f\u3002\u8fd9\u4e9b\u5e73\u53f0\u901a\u5e38\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u5de5\u5177\u96c6\uff0c\u4f7f\u5f97\u5728\u4e91\u4e0a\u8c03\u7528Python\u7a0b\u5e8f\u53d8\u5f97\u975e\u5e38\u7b80\u5355\u3002<\/p>\n<\/p>\n<p><h3>1. \u4f7f\u7528AWS Lambda<\/h3>\n<\/p>\n<p><p>AWS Lambda\u662f\u4e00\u4e2a\u65e0\u670d\u52a1\u5668\u8ba1\u7b97\u670d\u52a1\uff0c\u5141\u8bb8\u4f60\u8fd0\u884c\u4ee3\u7801\u800c\u65e0\u9700\u7ba1\u7406\u670d\u52a1\u5668\u3002\u4f60\u53ef\u4ee5\u5728Lambda\u4e2d\u8fd0\u884cPython\u7a0b\u5e8f\uff0c\u54cd\u5e94\u4e8b\u4ef6\u89e6\u53d1\u3002<\/p>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u521b\u5efa\u4e00\u4e2aLambda\u51fd\u6570\uff0c\u5e76\u9009\u62e9Python\u4f5c\u4e3a\u8fd0\u884c\u65f6\u3002\u7136\u540e\uff0c\u4e0a\u4f20\u4f60\u7684Python\u4ee3\u7801\u3002\u4f8b\u5982\uff0c\u4ee5\u4e0b\u4ee3\u7801\u5c06\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684Lambda\u51fd\u6570\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def lambda_handler(event, context):<\/p>\n<p>    return &quot;Hello from AWS Lambda!&quot;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>2. \u4f7f\u7528Google Cloud Functions<\/h3>\n<\/p>\n<p><p>Google Cloud Functions\u4e0eAWS Lambda\u7c7b\u4f3c\uff0c\u63d0\u4f9b\u4e86\u65e0\u670d\u52a1\u5668\u8ba1\u7b97\u73af\u5883\u3002\u4f60\u53ef\u4ee5\u5728Google Cloud Platform\u4e0a\u521b\u5efa\u548c\u8fd0\u884cPython\u51fd\u6570\u3002<\/p>\n<\/p>\n<p><p>\u521b\u5efa\u4e00\u4e2aCloud Function\uff0c\u5e76\u9009\u62e9Python\u4f5c\u4e3a\u7f16\u7a0b\u8bed\u8a00\u3002\u4e0a\u4f20\u4f60\u7684Python\u4ee3\u7801\uff0c\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def hello_world(request):<\/p>\n<p>    return &quot;Hello from Google Cloud Functions!&quot;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>3. \u4f7f\u7528Microsoft Azure Functions<\/h3>\n<\/p>\n<p><p>Azure Functions\u662fMicrosoft Azure\u7684\u65e0\u670d\u52a1\u5668\u8ba1\u7b97\u670d\u52a1\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528Azure Functions\u6765\u8fd0\u884cPython\u4ee3\u7801\u3002<\/p>\n<\/p>\n<p><p>\u5728Azure\u95e8\u6237\u4e2d\uff0c\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Function App\uff0c\u5e76\u9009\u62e9Python\u4f5c\u4e3a\u8fd0\u884c\u65f6\u3002\u7136\u540e\uff0c\u4e0a\u4f20\u4f60\u7684Python\u4ee3\u7801\uff0c\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def main(req):<\/p>\n<p>    return &quot;Hello from Azure Functions!&quot;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u4e91\u8ba1\u7b97\u5e73\u53f0\uff0c\u4f60\u53ef\u4ee5\u8f7b\u677e\u5730\u5728\u5168\u7403\u8303\u56f4\u5185\u90e8\u7f72\u548c\u8fd0\u884cPython\u7a0b\u5e8f\uff0c\u800c\u65e0\u9700\u62c5\u5fc3\u57fa\u7840\u8bbe\u65bd\u7ba1\u7406\u3002<\/p>\n<\/p>\n<p><h2>\u516b\u3001\u603b\u7ed3<\/h2>\n<\/p>\n<p><p>\u8c03\u7528Python\u7a0b\u5e8f\u6709\u591a\u79cd\u65b9\u5f0f\uff0c\u6bcf\u79cd\u65b9\u5f0f\u9002\u5408\u4e0d\u540c\u7684\u5e94\u7528\u573a\u666f\u3002<strong>\u65e0\u8bba\u662f\u901a\u8fc7\u547d\u4ee4\u884c\u3001API\u63a5\u53e3\u3001\u5d4c\u5165\u5230\u5176\u4ed6\u8bed\u8a00\u4e2d\u3001\u4f7f\u7528\u89e3\u91ca\u5668\u3001\u5916\u90e8\u5de5\u5177\u3001\u5bb9\u5668\u5316\u6280\u672f\uff0c\u8fd8\u662f\u4e91\u8ba1\u7b97\u5e73\u53f0\uff0c\u4f60\u90fd\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5<\/strong>\u3002\u5728\u73b0\u4ee3\u8f6f\u4ef6\u5f00\u53d1\u4e2d\uff0cPython\u7684\u5e7f\u6cdb\u5e94\u7528\u4f7f\u5f97\u5176\u8c03\u7528\u65b9\u5f0f\u53d8\u5f97\u591a\u6837\u5316\u548c\u7075\u6d3b\u5316\u3002\u901a\u8fc7\u5408\u7406\u9009\u62e9\u548c\u4f7f\u7528\u8fd9\u4e9b\u65b9\u6cd5\uff0c\u53ef\u4ee5\u663e\u8457\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u548c\u7a0b\u5e8f\u7684\u53ef\u7ef4\u62a4\u6027\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728CVi\u4e2d\u96c6\u6210Python\u811a\u672c\uff1f<\/strong><br \/>\u5728CVi\u73af\u5883\u4e2d\u96c6\u6210Python\u811a\u672c\uff0c\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528\u7cfb\u7edf\u8c03\u7528\u6216\u521b\u5efa\u81ea\u5b9a\u4e49DLL\u6765\u5b9e\u73b0\u3002\u60a8\u53ef\u4ee5\u5229\u7528<code>system()<\/code>\u51fd\u6570\u6765\u6267\u884cPython\u811a\u672c\uff0c\u786e\u4fddPython\u5df2\u5b89\u88c5\u5e76\u914d\u7f6e\u597d\u73af\u5883\u53d8\u91cf\u3002\u5177\u4f53\u6b65\u9aa4\u5305\u62ec\u7f16\u5199Python\u811a\u672c\u5e76\u901a\u8fc7\u547d\u4ee4\u884c\u8c03\u7528\uff0c\u6216\u8005\u5728CVi\u4e2d\u8bbe\u7f6e\u597d\u8def\u5f84\uff0c\u76f4\u63a5\u5728\u4ee3\u7801\u4e2d\u4f7f\u7528\u7cfb\u7edf\u8c03\u7528\u6765\u8fd0\u884cPython\u7a0b\u5e8f\u3002<\/p>\n<p><strong>CVi\u662f\u5426\u652f\u6301Python\u5e93\u7684\u76f4\u63a5\u8c03\u7528\uff1f<\/strong><br \/>CVi\u672c\u8eab\u4e0d\u76f4\u63a5\u652f\u6301Python\u5e93\u7684\u8c03\u7528\uff0c\u4f46\u53ef\u4ee5\u901a\u8fc7\u8c03\u7528Python\u89e3\u91ca\u5668\u6765\u95f4\u63a5\u5b9e\u73b0\u3002\u60a8\u53ef\u4ee5\u5728CVi\u9879\u76ee\u4e2d\u4f7f\u7528<code>system()<\/code>\u6216<code>CreateProcess()<\/code>\u7b49\u51fd\u6570\u6765\u8fd0\u884cPython\u811a\u672c\uff0c\u4ece\u800c\u5229\u7528Python\u5e93\u7684\u529f\u80fd\u3002\u9700\u8981\u786e\u4fddPython\u73af\u5883\u5df2\u6b63\u786e\u5b89\u88c5\uff0c\u5e76\u8bbe\u7f6e\u76f8\u5e94\u7684\u8def\u5f84\u3002<\/p>\n<p><strong>\u5982\u4f55\u5904\u7406CVi\u4e0ePython\u4e4b\u95f4\u7684\u6570\u636e\u4f20\u9012\uff1f<\/strong><br \/>\u4e3a\u4e86\u5728CVi\u548cPython\u4e4b\u95f4\u8fdb\u884c\u6570\u636e\u4f20\u9012\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u6587\u4ef6\u3001\u6570\u636e\u5e93\u6216\u901a\u8fc7\u6807\u51c6\u8f93\u5165\/\u8f93\u51fa\u6d41\u3002\u5c06\u6570\u636e\u5199\u5165\u6587\u4ef6\u6216\u4f7f\u7528JSON\u683c\u5f0f\u8fdb\u884c\u5e8f\u5217\u5316\u662f\u5e38\u89c1\u7684\u65b9\u6cd5\u3002Python\u811a\u672c\u53ef\u4ee5\u8bfb\u53d6\u8fd9\u4e9b\u6570\u636e\u5e76\u8fdb\u884c\u5904\u7406\uff0c\u5904\u7406\u540e\u7684\u7ed3\u679c\u518d\u4ee5\u76f8\u540c\u7684\u65b9\u5f0f\u8fd4\u56de\u7ed9CVi\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u53ef\u4ee5\u5b9e\u73b0\u4e24\u8005\u4e4b\u95f4\u7684\u6709\u6548\u6570\u636e\u4ea4\u4e92\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8c03\u7528Python\u7a0b\u5e8f\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u6cd5\u5b9e\u73b0\uff0c\u5305\u62ec\u4f7f\u7528\u547d\u4ee4\u884c\u3001\u901a\u8fc7API\u63a5\u53e3\u3001\u5d4c\u5165\u5230\u5176\u4ed6\u7f16\u7a0b\u8bed\u8a00\u4e2d\u3001\u4f7f\u7528Pytho [&hellip;]","protected":false},"author":3,"featured_media":1019124,"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\/1019109"}],"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=1019109"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1019109\/revisions"}],"predecessor-version":[{"id":1019125,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1019109\/revisions\/1019125"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1019124"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1019109"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1019109"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1019109"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}