{"id":1157397,"date":"2025-01-13T18:28:11","date_gmt":"2025-01-13T10:28:11","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1157397.html"},"modified":"2025-01-13T18:28:14","modified_gmt":"2025-01-13T10:28:14","slug":"%e5%a6%82%e4%bd%95%e7%94%a8python%e5%ae%9e%e6%97%b6%e7%9b%91%e6%8e%a7","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1157397.html","title":{"rendered":"\u5982\u4f55\u7528python\u5b9e\u65f6\u76d1\u63a7"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25195624\/d561744c-09d3-4a23-92ab-4c5a2c68bafc.webp\" alt=\"\u5982\u4f55\u7528python\u5b9e\u65f6\u76d1\u63a7\" \/><\/p>\n<p><p> <strong>\u5982\u4f55\u7528Python\u5b9e\u65f6\u76d1\u63a7\uff1a\u4f7f\u7528\u7cfb\u7edf\u76d1\u63a7\u5de5\u5177\u3001\u7f16\u5199\u81ea\u5b9a\u4e49\u811a\u672c\u3001\u5229\u7528\u7b2c\u4e09\u65b9\u5e93\u3001\u5b9e\u73b0\u6570\u636e\u53ef\u89c6\u5316\u3002<\/strong> \u5728\u8fd9\u51e0\u79cd\u65b9\u6cd5\u4e2d\uff0c\u5229\u7528\u7b2c\u4e09\u65b9\u5e93\u662f\u6700\u4e3a\u9ad8\u6548\u4e14\u7075\u6d3b\u7684\u65b9\u5f0f\u3002Python\u6709\u8bb8\u591a\u5f3a\u5927\u7684\u5e93\u53ef\u4ee5\u7528\u4e8e\u5b9e\u65f6\u76d1\u63a7\uff0c\u5982psutil\u3001py-cpuinfo\u7b49\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u83b7\u53d6\u7cfb\u7edf\u7684\u5404\u9879\u6027\u80fd\u6307\u6807\uff0c\u5e76\u4e14\u901a\u8fc7\u7ed3\u5408matplotlib\u3001plotly\u7b49\u53ef\u89c6\u5316\u5de5\u5177\uff0c\u53ef\u4ee5\u5b9e\u65f6\u5c55\u793a\u8fd9\u4e9b\u6570\u636e\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528\u7cfb\u7edf\u76d1\u63a7\u5de5\u5177<\/h3>\n<\/p>\n<p><h4>1. Psutil\u5e93<\/h4>\n<\/p>\n<p><p>Psutil\uff08Python system and process utilities\uff09\u662f\u4e00\u4e2a\u8de8\u5e73\u53f0\u5e93\uff0c\u80fd\u591f\u8f7b\u677e\u83b7\u53d6\u7cfb\u7edf\u8fd0\u884c\u65f6\u7684\u5404\u79cd\u6027\u80fd\u6307\u6807\uff0c\u5982CPU\u4f7f\u7528\u7387\u3001\u5185\u5b58\u4f7f\u7528\u7387\u3001\u78c1\u76d8\u8bfb\u5199\u901f\u7387\u3001\u7f51\u7edc\u6d41\u91cf\u7b49\u3002\u5b83\u63d0\u4f9b\u4e86\u4e00\u4e2a\u65b9\u4fbf\u7684\u63a5\u53e3\u6765\u83b7\u53d6\u7cfb\u7edf\u4fe1\u606f\u5e76\u8fdb\u884c\u5b9e\u65f6\u76d1\u63a7\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import psutil<\/p>\n<p>import time<\/p>\n<p>def monitor_system(interval=1):<\/p>\n<p>    while True:<\/p>\n<p>        cpu_usage = psutil.cpu_percent(interval=interval)<\/p>\n<p>        memory_info = psutil.virtual_memory()<\/p>\n<p>        disk_usage = psutil.disk_usage(&#39;\/&#39;)<\/p>\n<p>        net_io = psutil.net_io_counters()<\/p>\n<p>        print(f&quot;CPU Usage: {cpu_usage}%&quot;)<\/p>\n<p>        print(f&quot;Memory Usage: {memory_info.percent}%&quot;)<\/p>\n<p>        print(f&quot;Disk Usage: {disk_usage.percent}%&quot;)<\/p>\n<p>        print(f&quot;Network Sent: {net_io.bytes_sent} bytes, Received: {net_io.bytes_recv} bytes&quot;)<\/p>\n<p>        time.sleep(interval)<\/p>\n<h2><strong>Call the function to start monitoring<\/strong><\/h2>\n<p>monitor_system()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. Py-cpuinfo\u5e93<\/h4>\n<\/p>\n<p><p>Py-cpuinfo\u662f\u4e00\u4e2a\u4e13\u95e8\u7528\u4e8e\u83b7\u53d6CPU\u4fe1\u606f\u7684\u5e93\u3002\u5b83\u53ef\u4ee5\u83b7\u53d6\u5305\u62ecCPU\u578b\u53f7\u3001\u67b6\u6784\u3001\u9891\u7387\u7b49\u8be6\u7ec6\u4fe1\u606f\uff0c\u975e\u5e38\u9002\u5408\u9700\u8981\u76d1\u63a7CPU\u72b6\u6001\u7684\u573a\u666f\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import cpuinfo<\/p>\n<p>def get_cpu_info():<\/p>\n<p>    info = cpuinfo.get_cpu_info()<\/p>\n<p>    for key, value in info.items():<\/p>\n<p>        print(f&quot;{key}: {value}&quot;)<\/p>\n<h2><strong>Call the function to get CPU information<\/strong><\/h2>\n<p>get_cpu_info()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e8c\u3001\u7f16\u5199\u81ea\u5b9a\u4e49\u811a\u672c<\/h3>\n<\/p>\n<p><h4>1. \u81ea\u5b9a\u4e49\u8d44\u6e90\u76d1\u63a7\u811a\u672c<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u6839\u636e\u5b9e\u9645\u9700\u6c42\u7f16\u5199\u81ea\u5b9a\u4e49\u811a\u672c\uff0c\u5b9e\u73b0\u7279\u5b9a\u7684\u76d1\u63a7\u529f\u80fd\u3002\u4f8b\u5982\uff0c\u76d1\u63a7\u7279\u5b9a\u8fdb\u7a0b\u7684CPU\u548c\u5185\u5b58\u4f7f\u7528\u7387\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import psutil<\/p>\n<p>import time<\/p>\n<p>def monitor_process(pid, interval=1):<\/p>\n<p>    try:<\/p>\n<p>        process = psutil.Process(pid)<\/p>\n<p>        while True:<\/p>\n<p>            cpu_usage = process.cpu_percent(interval=interval)<\/p>\n<p>            memory_info = process.memory_info()<\/p>\n<p>            print(f&quot;Process {pid} CPU Usage: {cpu_usage}%&quot;)<\/p>\n<p>            print(f&quot;Process {pid} Memory Usage: {memory_info.rss \/ 1024 \/ 1024} MB&quot;)<\/p>\n<p>            time.sleep(interval)<\/p>\n<p>    except psutil.NoSuchProcess:<\/p>\n<p>        print(f&quot;No process found with PID {pid}&quot;)<\/p>\n<h2><strong>Call the function to start monitoring a specific process<\/strong><\/h2>\n<p>monitor_process(12345)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u81ea\u5b9a\u4e49\u7f51\u7edc\u76d1\u63a7\u811a\u672c<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u7f16\u5199\u811a\u672c\u5b9e\u65f6\u76d1\u63a7\u7f51\u7edc\u6d41\u91cf\uff0c\u8bb0\u5f55\u7f51\u7edc\u6570\u636e\u5305\u7684\u53d1\u9001\u548c\u63a5\u6536\u60c5\u51b5\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import psutil<\/p>\n<p>import time<\/p>\n<p>def monitor_network(interval=1):<\/p>\n<p>    while True:<\/p>\n<p>        net_io = psutil.net_io_counters()<\/p>\n<p>        print(f&quot;Network Sent: {net_io.bytes_sent} bytes, Received: {net_io.bytes_recv} bytes&quot;)<\/p>\n<p>        time.sleep(interval)<\/p>\n<h2><strong>Call the function to start monitoring network traffic<\/strong><\/h2>\n<p>monitor_network()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e09\u3001\u5229\u7528\u7b2c\u4e09\u65b9\u5e93<\/h3>\n<\/p>\n<p><h4>1. Matplotlib\u5e93<\/h4>\n<\/p>\n<p><p>Matplotlib\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u7ed8\u56fe\u5e93\uff0c\u53ef\u4ee5\u7528\u4e8e\u5b9e\u65f6\u7ed8\u5236\u7cfb\u7edf\u6027\u80fd\u6307\u6807\u56fe\u8868\uff0c\u5e2e\u52a9\u53ef\u89c6\u5316\u76d1\u63a7\u6570\u636e\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import matplotlib.pyplot as plt<\/p>\n<p>import matplotlib.animation as animation<\/p>\n<p>import psutil<\/p>\n<p>fig, ax = plt.subplots()<\/p>\n<p>xdata, ydata = [], []<\/p>\n<p>ln, = plt.plot([], [], &#39;r-&#39;, animated=True)<\/p>\n<p>def init():<\/p>\n<p>    ax.set_xlim(0, 10)<\/p>\n<p>    ax.set_ylim(0, 100)<\/p>\n<p>    return ln,<\/p>\n<p>def update(frame):<\/p>\n<p>    xdata.append(frame)<\/p>\n<p>    ydata.append(psutil.cpu_percent())<\/p>\n<p>    ln.set_data(xdata, ydata)<\/p>\n<p>    ax.set_xlim(0, max(10, frame))<\/p>\n<p>    return ln,<\/p>\n<p>ani = animation.FuncAnimation(fig, update, frames=range(100), init_func=init, blit=True)<\/p>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. Plotly\u5e93<\/h4>\n<\/p>\n<p><p>Plotly\u662f\u53e6\u4e00\u4e2a\u975e\u5e38\u6d41\u884c\u7684\u53ef\u89c6\u5316\u5e93\uff0c\u652f\u6301\u4ea4\u4e92\u5f0f\u56fe\u8868\u548c\u5b9e\u65f6\u6570\u636e\u66f4\u65b0\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import plotly.graph_objs as go<\/p>\n<p>from plotly.subplots import make_subplots<\/p>\n<p>import psutil<\/p>\n<p>import time<\/p>\n<p>fig = make_subplots(rows=1, cols=1)<\/p>\n<p>def update_plot():<\/p>\n<p>    fig.add_trace(go.Scatter(x=[], y=[], mode=&#39;lines&#39;, name=&#39;CPU Usage&#39;))<\/p>\n<p>    while True:<\/p>\n<p>        cpu_usage = psutil.cpu_percent()<\/p>\n<p>        fig.update_traces(go.Scatter(x=[time.time()], y=[cpu_usage]))<\/p>\n<p>        time.sleep(1)<\/p>\n<h2><strong>Call the function to start updating the plot<\/strong><\/h2>\n<p>update_plot()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u56db\u3001\u5b9e\u73b0\u6570\u636e\u53ef\u89c6\u5316<\/h3>\n<\/p>\n<p><h4>1. \u4f7f\u7528Dash\u6846\u67b6<\/h4>\n<\/p>\n<p><p>Dash\u662fPlotly\u7684\u4e00\u4e2a\u6846\u67b6\uff0c\u53ef\u4ee5\u7528\u4e8e\u6784\u5efa\u4ea4\u4e92\u5f0fWeb\u5e94\u7528\uff0c\u9002\u5408\u5b9e\u73b0\u5b9e\u65f6\u76d1\u63a7\u9762\u677f\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import dash<\/p>\n<p>from dash import dcc, html<\/p>\n<p>from dash.dependencies import Input, Output<\/p>\n<p>import psutil<\/p>\n<p>import time<\/p>\n<p>app = dash.Dash(__name__)<\/p>\n<p>app.layout = html.Div([<\/p>\n<p>    dcc.Graph(id=&#39;live-update-graph&#39;),<\/p>\n<p>    dcc.Interval(id=&#39;interval-component&#39;, interval=1*1000, n_intervals=0)<\/p>\n<p>])<\/p>\n<p>@app.callback(Output(&#39;live-update-graph&#39;, &#39;figure&#39;),<\/p>\n<p>              [Input(&#39;interval-component&#39;, &#39;n_intervals&#39;)])<\/p>\n<p>def update_graph_live(n):<\/p>\n<p>    cpu_usage = psutil.cpu_percent()<\/p>\n<p>    fig = go.Figure(go.Scatter(x=[time.time()], y=[cpu_usage], mode=&#39;lines&#39;, name=&#39;CPU Usage&#39;))<\/p>\n<p>    return fig<\/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_server(debug=True)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u4f7f\u7528Bokeh\u5e93<\/h4>\n<\/p>\n<p><p>Bokeh\u662f\u4e00\u4e2a\u7528\u4e8e\u521b\u5efa\u4ea4\u4e92\u5f0f\u56fe\u8868\u548c\u6570\u636e\u5e94\u7528\u7684\u5e93\uff0c\u9002\u5408\u7528\u4e8e\u5b9e\u65f6\u6570\u636e\u53ef\u89c6\u5316\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from bokeh.io import curdoc<\/p>\n<p>from bokeh.layouts import column<\/p>\n<p>from bokeh.models import ColumnDataSource<\/p>\n<p>from bokeh.plotting import figure<\/p>\n<p>import psutil<\/p>\n<p>import time<\/p>\n<p>source = ColumnDataSource(data=dict(x=[], y=[]))<\/p>\n<p>p = figure(title=&quot;CPU Usage&quot;, x_axis_type=&#39;datetime&#39;)<\/p>\n<p>p.line(x=&#39;x&#39;, y=&#39;y&#39;, source=source)<\/p>\n<p>def update():<\/p>\n<p>    new_data = dict(x=[time.time()], y=[psutil.cpu_percent()])<\/p>\n<p>    source.stream(new_data, rollover=200)<\/p>\n<p>curdoc().add_periodic_callback(update, 1000)<\/p>\n<p>curdoc().add_root(column(p))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e94\u3001\u7efc\u5408\u5e94\u7528\u793a\u4f8b<\/h3>\n<\/p>\n<p><h4>1. \u7efc\u5408\u7cfb\u7edf\u76d1\u63a7<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u7ed3\u5408\u4e0a\u8ff0\u5404\u7c7b\u5e93\u548c\u65b9\u6cd5\uff0c\u5b9e\u73b0\u4e00\u4e2a\u7efc\u5408\u7684\u7cfb\u7edf\u76d1\u63a7\u811a\u672c\uff0c\u76d1\u63a7CPU\u3001\u5185\u5b58\u3001\u78c1\u76d8\u3001\u7f51\u7edc\u7b49\u591a\u4e2a\u6307\u6807\uff0c\u5e76\u5b9e\u65f6\u5c55\u793a\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import psutil<\/p>\n<p>import matplotlib.pyplot as plt<\/p>\n<p>import matplotlib.animation as animation<\/p>\n<p>import time<\/p>\n<p>fig, (ax1, ax2, ax3, ax4) = plt.subplots(4, 1)<\/p>\n<p>cpu_data, mem_data, disk_data, net_data = [], [], [], []<\/p>\n<p>def update(frame):<\/p>\n<p>    cpu_data.append(psutil.cpu_percent())<\/p>\n<p>    mem_data.append(psutil.virtual_memory().percent)<\/p>\n<p>    disk_data.append(psutil.disk_usage(&#39;\/&#39;).percent)<\/p>\n<p>    net_io = psutil.net_io_counters()<\/p>\n<p>    net_data.append(net_io.bytes_sent + net_io.bytes_recv)<\/p>\n<p>    ax1.clear()<\/p>\n<p>    ax2.clear()<\/p>\n<p>    ax3.clear()<\/p>\n<p>    ax4.clear()<\/p>\n<p>    ax1.plot(cpu_data, &#39;r-&#39;)<\/p>\n<p>    ax2.plot(mem_data, &#39;g-&#39;)<\/p>\n<p>    ax3.plot(disk_data, &#39;b-&#39;)<\/p>\n<p>    ax4.plot(net_data, &#39;y-&#39;)<\/p>\n<p>    ax1.set_title(&#39;CPU Usage&#39;)<\/p>\n<p>    ax2.set_title(&#39;Memory Usage&#39;)<\/p>\n<p>    ax3.set_title(&#39;Disk Usage&#39;)<\/p>\n<p>    ax4.set_title(&#39;Network Usage&#39;)<\/p>\n<p>ani = animation.FuncAnimation(fig, update, frames=range(100), interval=1000)<\/p>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u7efc\u5408\u7f51\u7edc\u76d1\u63a7<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u5b9e\u73b0\u4e00\u4e2a\u5b9e\u65f6\u76d1\u63a7\u7f51\u7edc\u6d41\u91cf\u7684\u811a\u672c\uff0c\u8bb0\u5f55\u6bcf\u4e2a\u65f6\u95f4\u6bb5\u5185\u7684\u6570\u636e\u5305\u53d1\u9001\u548c\u63a5\u6536\u60c5\u51b5\uff0c\u5e76\u53ef\u89c6\u5316\u5c55\u793a\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import psutil<\/p>\n<p>import matplotlib.pyplot as plt<\/p>\n<p>import matplotlib.animation as animation<\/p>\n<p>import time<\/p>\n<p>fig, ax = plt.subplots()<\/p>\n<p>net_data = []<\/p>\n<p>def update(frame):<\/p>\n<p>    net_io = psutil.net_io_counters()<\/p>\n<p>    net_data.append(net_io.bytes_sent + net_io.bytes_recv)<\/p>\n<p>    ax.clear()<\/p>\n<p>    ax.plot(net_data, &#39;y-&#39;)<\/p>\n<p>    ax.set_title(&#39;Network Usage&#39;)<\/p>\n<p>ani = animation.FuncAnimation(fig, update, frames=range(100), interval=1000)<\/p>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u51e0\u79cd\u65b9\u6cd5\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528Python\u5b9e\u73b0\u5404\u79cd\u5f62\u5f0f\u7684\u5b9e\u65f6\u76d1\u63a7\uff0c\u5e2e\u52a9\u66f4\u597d\u5730\u4e86\u89e3\u548c\u7ba1\u7406\u7cfb\u7edf\u7684\u5404\u9879\u6027\u80fd\u6307\u6807\u3002\u65e0\u8bba\u662f\u4f7f\u7528\u7cfb\u7edf\u76d1\u63a7\u5de5\u5177\u3001\u7f16\u5199\u81ea\u5b9a\u4e49\u811a\u672c\u3001\u5229\u7528\u7b2c\u4e09\u65b9\u5e93\u8fd8\u662f\u5b9e\u73b0\u6570\u636e\u53ef\u89c6\u5316\uff0c\u90fd\u80fd\u6ee1\u8db3\u4e0d\u540c\u7684\u76d1\u63a7\u9700\u6c42\uff0c\u63d0\u4f9b\u5b9e\u65f6\u7684\u76d1\u63a7\u6570\u636e\u548c\u53ef\u89c6\u5316\u5c55\u793a\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5b9e\u65f6\u76d1\u63a7\u5728Python\u4e2d\u6709\u54ea\u4e9b\u5e38\u89c1\u7684\u5e94\u7528\u573a\u666f\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u5b9e\u65f6\u76d1\u63a7\u53ef\u4ee5\u5e94\u7528\u4e8e\u591a\u4e2a\u9886\u57df\uff0c\u4f8b\u5982\u7cfb\u7edf\u6027\u80fd\u76d1\u63a7\u3001\u7f51\u7edc\u6d41\u91cf\u76d1\u63a7\u3001\u670d\u52a1\u5668\u72b6\u6001\u76d1\u63a7\u4ee5\u53ca\u4f20\u611f\u5668\u6570\u636e\u91c7\u96c6\u7b49\u3002\u901a\u8fc7\u4f7f\u7528Python\u7684\u5e93\uff0c\u5982psutil\u76d1\u63a7CPU\u548c\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\u3001\u4f7f\u7528requests\u5e93\u83b7\u53d6\u7f51\u7edc\u72b6\u6001\uff0c\u6216\u501f\u52a9Flask\u521b\u5efaWeb\u5e94\u7528\u7a0b\u5e8f\u6765\u663e\u793a\u5b9e\u65f6\u6570\u636e\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u7075\u6d3b\u5730\u5b9e\u73b0\u5404\u7c7b\u76d1\u63a7\u9879\u76ee\u3002<\/p>\n<p><strong>\u4f7f\u7528Python\u8fdb\u884c\u5b9e\u65f6\u76d1\u63a7\u9700\u8981\u54ea\u4e9b\u5e38\u7528\u5e93\u6216\u5de5\u5177\uff1f<\/strong><br \/>\u8fdb\u884c\u5b9e\u65f6\u76d1\u63a7\u65f6\uff0cPython\u5f00\u53d1\u8005\u901a\u5e38\u4f1a\u4f7f\u7528\u4e00\u4e9b\u5f3a\u5927\u7684\u5e93\u548c\u5de5\u5177\u3002\u4f8b\u5982\uff0cpsutil\u7528\u4e8e\u83b7\u53d6\u7cfb\u7edf\u548c\u8fdb\u7a0b\u7684\u5b9e\u65f6\u4fe1\u606f\uff0cmatplotlib\u548cseaborn\u53ef\u4ee5\u7528\u6765\u53ef\u89c6\u5316\u76d1\u63a7\u6570\u636e\uff0cTwisted\u6216Socket.io\u5219\u9002\u5408\u5904\u7406\u7f51\u7edc\u901a\u4fe1\u3002\u6b64\u5916\uff0c\u4f7f\u7528Flask\u6216Django\u7b49\u6846\u67b6\uff0c\u53ef\u4ee5\u8f7b\u677e\u6784\u5efa\u4e00\u4e2a\u5b9e\u65f6\u76d1\u63a7\u7684Web\u754c\u9762\uff0c\u5c55\u793a\u76d1\u63a7\u6570\u636e\u3002<\/p>\n<p><strong>\u5982\u4f55\u5b9e\u73b0Python\u5b9e\u65f6\u76d1\u63a7\u6570\u636e\u7684\u53ef\u89c6\u5316\uff1f<\/strong><br \/>\u8981\u5b9e\u73b0\u6570\u636e\u7684\u53ef\u89c6\u5316\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u4f7f\u7528matplotlib\u3001Plotly\u6216Dash\u7b49\u5e93\u3002\u901a\u8fc7\u8fd9\u4e9b\u5de5\u5177\uff0c\u53ef\u4ee5\u5c06\u76d1\u63a7\u6570\u636e\u4ee5\u56fe\u8868\u6216\u56fe\u5f62\u7684\u5f62\u5f0f\u5c55\u73b0\u3002\u4f8b\u5982\uff0c\u4f7f\u7528matplotlib\u7ed8\u5236\u5b9e\u65f6\u66f4\u65b0\u7684\u6298\u7ebf\u56fe\uff0c\u6216\u8005\u4f7f\u7528Plotly\u521b\u5efa\u4ea4\u4e92\u5f0f\u56fe\u8868\uff0c\u7528\u6237\u53ef\u4ee5\u66f4\u76f4\u89c2\u5730\u4e86\u89e3\u7cfb\u7edf\u72b6\u6001\u548c\u6027\u80fd\u6307\u6807\u3002\u6570\u636e\u53ef\u89c6\u5316\u4e0d\u4ec5\u63d0\u5347\u4e86\u4fe1\u606f\u7684\u4f20\u9012\u6548\u7387\uff0c\u4e5f\u8ba9\u76d1\u63a7\u7ed3\u679c\u66f4\u52a0\u6613\u4e8e\u7406\u89e3\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5982\u4f55\u7528Python\u5b9e\u65f6\u76d1\u63a7\uff1a\u4f7f\u7528\u7cfb\u7edf\u76d1\u63a7\u5de5\u5177\u3001\u7f16\u5199\u81ea\u5b9a\u4e49\u811a\u672c\u3001\u5229\u7528\u7b2c\u4e09\u65b9\u5e93\u3001\u5b9e\u73b0\u6570\u636e\u53ef\u89c6\u5316\u3002 \u5728\u8fd9\u51e0\u79cd\u65b9\u6cd5\u4e2d\uff0c [&hellip;]","protected":false},"author":3,"featured_media":1157401,"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\/1157397"}],"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=1157397"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1157397\/revisions"}],"predecessor-version":[{"id":1157402,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1157397\/revisions\/1157402"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1157401"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1157397"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1157397"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1157397"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}