1. 修改 pyconfig.h

1.1 将 

#ifdef _DEBUG 
# define Py_DEBUG 
#endif 

改为

#ifdef _DEBUG 
//# define Py_DEBUG 
#endif 

1.2 将

# ifdef _DEBUG 
# pragma comment(lib,"python27_d.lib") 
# else 
# pragma comment(lib,"python27.lib") 
# endif /* _DEBUG */ 

改为

# ifdef _DEBUG 
# pragma comment(lib,"python27.lib") 
# else 
# pragma comment(lib,"python27.lib") 
# endif /* _DEBUG */ 

2. 修改object.h

#if defined(Py_DEBUG) && !defined(Py_TRACE_REFS) 
#define Py_TRACE_REFS 
#endif 

改为

#if defined(Py_DEBUG) && !defined(Py_TRACE_REFS) 
// #define Py_TRACE_REFS 
#endif

 参考:

【1】http://blog.csdn.net/junparadox/article/details/52704287