<p style="margin-top:0px;margin-right:0px;margin-bottom:1em;margin-left:0px;padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;font:normal normal normal 14px/1.4 Arial,Helvetica,Georgia,sans-serif;color:rgb(33,33,33);font-family:Arial,Helvetica,Georgia,sans-serif;font-size:14px;text-align:left;background-color:rgb(215,210,188)">

----------------------------------</p><p style="margin-top:0px;margin-right:0px;margin-bottom:1em;margin-left:0px;padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;font:normal normal normal 14px/1.4 Arial,Helvetica,Georgia,sans-serif;color:rgb(33,33,33);font-family:Arial,Helvetica,Georgia,sans-serif;font-size:14px;text-align:left;background-color:rgb(215,210,188)">

test.cpp:</p><p style="margin-top:0px;margin-right:0px;margin-bottom:1em;margin-left:0px;padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;font:normal normal normal 14px/1.4 Arial,Helvetica,Georgia,sans-serif;color:rgb(33,33,33);font-family:Arial,Helvetica,Georgia,sans-serif;font-size:14px;text-align:left;background-color:rgb(215,210,188)">

#include&lt;Python.h&gt;<br>void test2()</p><p style="margin-top:0px;margin-right:0px;margin-bottom:1em;margin-left:0px;padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;font:normal normal normal 14px/1.4 Arial,Helvetica,Georgia,sans-serif;color:rgb(33,33,33);font-family:Arial,Helvetica,Georgia,sans-serif;font-size:14px;text-align:left;background-color:rgb(215,210,188)">

{<br>//        int b;<br>Py_Initialize();<br>PyRun_SimpleString(“from matplotlib.pyplot import plotfile\n”<br>“from pylab import show\n”<br>“plotfile(‘/home/huskier/Desktop/data’)\n”//data file is just nums of 10 rows<br>“show()\n”);<br>

Py_Finalize();<br>}</p><p style="margin-top:0px;margin-right:0px;margin-bottom:1em;margin-left:0px;padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;font:normal normal normal 14px/1.4 Arial,Helvetica,Georgia,sans-serif;color:rgb(33,33,33);font-family:Arial,Helvetica,Georgia,sans-serif;font-size:14px;text-align:left;background-color:rgb(215,210,188)">

int<br>main(int argc,char *argv[])<br>{<br>test2();<br>test2();<br>return 0;<br>}</p><p style="margin-top:0px;margin-right:0px;margin-bottom:1em;margin-left:0px;padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;font:normal normal normal 14px/1.4 Arial,Helvetica,Georgia,sans-serif;color:rgb(33,33,33);font-family:Arial,Helvetica,Georgia,sans-serif;font-size:14px;text-align:left;background-color:rgb(215,210,188)">

------------------------</p><p style="margin-top:0px;margin-right:0px;margin-bottom:1em;margin-left:0px;padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;font:normal normal normal 14px/1.4 Arial,Helvetica,Georgia,sans-serif;color:rgb(33,33,33);font-family:Arial,Helvetica,Georgia,sans-serif;font-size:14px;text-align:left;background-color:rgb(215,210,188)">

How to work well?And the memory cann&#39;t free when use test2() in QT,if you plot many times at once.</p>