python34_d.lib这个文件在哪层目录下,,我自己写了一个例子,用C
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。
编橙之家文章,
相关内容
- Python中Django上传大型文件需要怎么配置,pythondjango,Dj
- 去哪找python初学者学习的好项目,github可以吗,pythongi
- 想把网页数据全都抓下来,需要什么样的思路?,网页思
- Python定义变量list int应该怎样定义?,pythonlist,如题。如
- Python flask url参数应该如何写,pythonflask,常见 url 传参中
- 怎么解决python tornado总是需要重启的问题,pythontornado
- Python Flask中分散存储大量视频函数的方法,pythonflask,由
- 多层嵌套字典中unicode编码如何完美的输出python2.x环境,
- 请教Python flask gevent聊天室功能上一些问题,flaskgevent
- 需要flask+mysql实现用户注册和登陆效果页面如何实现,
评论关闭