c++ - Using numpy module in pythonQt -
i want use python(especially numpy pkg) in qt, use pythonqt purpose. since need numpy python module use flags initial pythonqt.
pythonqt::init(pythonqt::externalhelp);
for testing numpy use simple sample test can see below
int main(int argc, char *argv[]){ qcoreapplication a(argc,argv); pythonqt::init(pythonqt::externalhelp); pythonqtobjectptr context=pythonqt::self()->getmainmodule(); context.evalscript(“import numpy\ndef mul(a,b):\n return a*b”); qvariantlist args; args<<42<<2; qvariant result=context.call(“mul”,args); qdebug()<<result.tostring(); return a.exec(); }
when run above simple code, raise error : file "/usr/local/lib/python-64bit-3.4.3/lib/site-packages/numpy/core/init.py", line 5, in importerror: no module named multiarray
i create simple project in c++ , add python.h header file , python lib directory project in order test numpy. result ok , work correctly, in pythonqt doesn’t work. searched alot error , none of them solved problem.
i need solve problem tanks helping
finally after lot of attempting solving problem founded pythonqt should build in release mode working correctly(as mention in documention of pythonqt). since compile python3.4,i debugging pythonqt because build pythonqt in debuging mode generate pythonqt.pdb file me, in debug mode doesn't work correctly. leave post 1 comes same problem.
Comments
Post a Comment