C++调用python脚本(test.py这个脚本中import numpy)程序崩溃

我想在c++中调用python的一个脚本,这个脚本中我只是import了一个numpy就报错了,而如果是简单的脚本(没有import第三方库)就不会出错,我已经把:
INCLUDEPATH += C:/Python27/include/
LIBS += C:/Python27/libs/python27.lib
添加进去了,

  pyrun_simplestring("import sys");
  pyrun_simplestring("import numpy");
  pyrun_simplestring("sys.path.append('c:\python27\lib\site-packages\')");
  pyerr_print();
  pyobject * pmodule = null;
  pyobject * pfunc = null;
  pmodule =pyimport_importmodule("test_my");      //test001:python文件名
  pfunc= pyobject_getattrstring(pmodule, "testdict"); //add:python文件中的函数名
  pyobject *pargs = pytuple_new(1);
  pyobject *pdict = pydict_new();        //创建字典类型变量
  pydict_setitemstring(pdict, "name", py_buildvalue("s", "wangyao"));     //往字典类型变量中填充数据
  pydict_setitemstring(pdict, "age", py_buildvalue("i", 25));             //往字典类型变量中填充数据
  pytuple_setitem(pargs, 0, pdict);                 //0---序号  将字典类型变量添加到参数元组中

  pyobject *preturn = null;
  preturn = pyeval_callobject(pfunc, pargs);      //调用函数
  int size = pydict_size(preturn);
  cout << "返回字典的大小为: " << size << endl;
  pyobject *pnewage = pydict_getitemstring(preturn, "age");
  int newage;
  pyarg_parse(pnewage, "i", &newage);
  cout << "true age: " << newage << endl;

  py_finalize();

这是python的脚本:

 #import numpy as np
def HelloWorld():  
    print "Hello World"  
def add(a, b):
    #tmp=np.random.randint(10,88)   
    return a+b  
def TestDict(dict):  
    print dict  
    dict["Age"] = 17  
    return dict  
class Person:  
    def greet(self, greetStr):  
        print greetStr  
#print add(5,7)  
#a = raw_input("Enter To Continue...")

老是报错,但如果我把import numpy去掉就没问题,求大神解答,困扰好久了~~~

http://blog.csdn.net/lichkingyang/article/details/52061051

楼主 我也遇到这个问题 你解决了么。。。。求交流 很急

很急,我也遇到这个问题,不知道怎么解决,是C++和Python的版本不兼容吗?好晕~~

我也是同样的问题,import numpy 或者 tensorflow都不行。楼主解决了吗?

我也一样的问题,最后怎么解决的?版本问题还是其它?

多次重复调用py文件,没有有效释放,导致在内存中累积,最终内存崩溃