python34_d.lib这个文件在哪层目录下,,我自己写了一个例子,用C


我自己写了一个例子,用C语言调用Python。
但是我在编译的时候发现,如果是Debug模式的话,会需要python34_d.lib这个文件(当然,如果是Release模式的话,需要的是python34.lib这个文件)。

我找了官方发布的资源,并没有python34_d.lib这个文件。所以问下去哪里能够找到?

我觉得,作为一个非Python核心开发者,我肯定不需要自己编一个debug版的python来调试。所以我觉得官方应该有这个资源吧?
当然,也有可能有办法关闭这个选项。


这个是我写的C语言调用python的例子:

#include <stdio.h>#include <stdlib.h>#include <Python.h>int main(int argc, char* argv[]){    PyObject* sys;    Py_Initialize();    sys = PyImport_ImportModule("sys");    PyObject* version = PyObject_GetAttrString(sys, "version");    printf("%s\n", PyUnicode_AsUTF8(version));    Py_Finalize();    return 0;}

因为%PythonInstallPath%/include/pyconfig.h中的如下片段,所以需要python34_d.lib文件:

/* For an MSVC DLL, we can nominate the .lib files used by extensions */#ifdef MS_COREDLL#   ifndef Py_BUILD_CORE /* not building the core - must be an ext */#       if defined(_MSC_VER)            /* So MSVC users need not specify the .lib file in            their Makefile (other compilers are generally            taken care of by distutils.) */#           if defined(_DEBUG)#               pragma comment(lib,"python34_d.lib")#           elif defined(Py_LIMITED_API)#               pragma comment(lib,"python3.lib")#           else#               pragma comment(lib,"python34.lib")#           endif /* _DEBUG */#       endif /* _MSC_VER */#   endif /* Py_BUILD_CORE */#endif /* MS_COREDLL */

最后,这个是我的测试环境:
Windows8.1 64位,Visual Studio Express 2013,Python 3.4.2 64位。

装个最新的 PTVS 插件

居然还被踩,我r

不是很简单吗?我也找不到,吧“pyconfig.h"的文件改了:
if defined(_DEBUG)

pragma comment(lib,"python34.lib")

就行了。

你得用VS编译一份DEBUG版的python。

编橙之家文章,

评论关闭