为什么#include< Python.h>工作? [英] Why doesn't #include <Python.h> work?

查看:1299
本文介绍了为什么#include< Python.h>工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用#include< Python.h>在C ++中运行Python模块,但是,在设置了Additional Include Dependencies项目到\include调试时出现以下错误,

I'm trying to run Python modules in C++ using "#include <Python.h>", however, after setting the "Additional Include Dependencies" of the project to "\include" I get the following error when debuging,

LINK : fatal error LNK1104: cannot open file 'python27_d.lib'



我读到我应该下载Python的开发版本,但我没有找到一个链接,加,不,我只需要将文件'python27_d.lib'复制到libs文件夹?

I read that I should download the development version of Python, but I didn't find a link for that, plus, don't I just need the file 'python27_d.lib' to be copied to the "libs" folder?

请注意,

推荐答案

我不知道python,但是消息表明python27_d.lib不存在,或至少不存在链接器正在寻找它。

I don't know much about python, but the message indicates that python27_d.lib either doesn't exist, or at least doesn't exist where the linker is looking for it.

您已经修复了编译器include问题,现在使用Windows资源管理器查找python27_d.lib文件,并将该路径添加到Additional Library Dependencies路径。它在配置 - >链接器 - >常规 - >附加库目录下。

You already fixed the compiler include issue, now find the python27_d.lib file with Windows Explorer and and add that path to the Additional Library Dependencies path. It's under Configuration -> Linker -> General -> Additional Library Directories.

_d表示它是一个调试库,配置,而没有_d(可能)用于您的发行版配置。

The "_d" indicates it's a debug library, so you'll want that one for your Debug configuration, and the one without the "_d" (probably) for your release configuration.

这篇关于为什么#include&lt; Python.h&gt;工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆