calling python (matplotlib) from c++

S

someone

Hi all,

I want to call python (matplotlib) from C++. I use ubuntu linux and
compile with "-lpython2.7". Besides that, I have this line included:

#include <python2.7/Python.h>

I can then do something like this:

Py_Initialize();
PyRun_SimpleString("print ' '");
PyRun_SimpleString("print ' '");
PyRun_SimpleString("print ' '");
PyRun_SimpleString("print 'PYTHON RUNNING =============='");
PyRun_SimpleString("from time import time,ctime\n"
"print 'Today is',ctime(time())\n");
// Py_Main(argc, argv); // start up the python interpreter
Py_Finalize();

However - I cannot seem to pass two arrays of data, so I can plot the
data using matplotlib... I cannot even start matplotlib... Please
help/advice/come up with suggestions, someone who knows what to do :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,955
Messages
2,570,117
Members
46,705
Latest member
v_darius

Latest Threads

Top