建筑/包括提振.VS2013中的Python
Building/including Boost.Python in VS2013
谁能告诉我,如果我做错了什么。
我在Windows 7上使用Visual Studio 2013,我希望能够能够设置一个简单的Boost。Python项目。我不知道我是否做错了构建 boost或当包括 boost在我的项目。
误差当我尝试#include
任何boost python模块时,例如#include <boost/python/module.hpp>
,我在Visual Studio中得到以下错误:
1>c:boost_1_55_0boostpythondetailwrap_python.hpp(50): fatal error C1083: Cannot open include file: 'pyconfig.h': No such file or directory
<<p> 建筑/strong> 我试着遵循这个SO线程的指令,其中KTC地址Python,这个Python如何从Boost,但是由于两个链接都有点过时,正在做不同的事情,并且一些步骤似乎在较新的Boost版本中发生了变化,我不得不即兴创作一些指令。
这就是我所做的。
- 解压最新版本(1.55)的Boost源文件到
C:boost_1_55_0
。 - 使用
cmd.exe
导航到C:boost_1_55_0
。(我没有使用Microsoft Visual Studio 12.0Common7ToolsShortcuts
下的Developer Command Prompt for VS2013
。这应该没什么区别,对吧?boost 1.55的官方指南没有特别提到使用Command Prompt for VS2013
。 - 使用
bootstrap
在cmd. - 编辑
project-config.jam
(由bootstrap
创建)并添加路径到我的Python 3.4安装C:Python34
。我的.jam
文件现在看起来像Project-Config.jam. - 在cmd中使用
.b2
启动构建过程。虽然我在构建期间有很多警告(forcing value to bool 'true' or 'false' (performance warning)
等),但构建完成后似乎没有任何错误消息。
这就是我在Visual Studio中创建项目的方法。
- 新建项目
- 增加了测试代码中的代码。
- 项目属性中的vc++目录下:
- 添加
C:boost_1_55_0
到Include Directories
。 - 添加
C:boost_1_55_0stagelib
(我可以找到.lib
文件的文件夹)到Library Directories
.
- 添加
Project-Config.jam
import option ;
using msvc ;
option.set keep-going : false ;
using python : 3.4 : C:\Python34\python ;
<<p> 测试代码/strong> From: boost_1_55_0libspythonexamplegetting_started1.cpp
#include <boost/python/module.hpp>
#include <boost/python/def.hpp>
#include <string>
namespace
{
// A couple of simple C++ functions that we want to expose to Python.
std::string greet() { return "hello, world"; }
int square(int number) { return number * number; }
}
namespace python = boost::python;
BOOST_PYTHON_MODULE(getting_started1)
{
// Add regular functions to the module.
python::def("greet", greet);
python::def("square", square);
}
似乎我只需要在我的Include和Library依赖项中添加Python34/include/
和Python34/libs/
的路径。
相关文章:
- 错误,在嵌入在C++程序中的 python 脚本中使用 matplotlib 时
- 相当于C++运算符中的 Python
- Boost.Python.ArgumentError: World.set(World, str) 中的 Python
- 获取 C++ 中的 Python 函数参数名称
- 在 boost::p ython 中的 python 对象中运行 python 代码
- C DLL中的Python对象
- 如何隐藏嵌入在 c++ 应用程序中的 python 代码
- 如何在 Heroku 中的 Python 服务器上执行 "g++" 命令?
- 从C 中的Python程序中检索stderr
- Cython将扩展模块传递到to_py_call_code错误中的python reults
- C 17中的Python风格装饰器
- 使用 C++ 中的 python 函数
- 如何停止/暂停嵌入在 c++ 中的 python 脚本
- 如何中断嵌入C++应用程序中的python解释器
- 无法获得新的 tf。在 Tensorflow 中的 Python shell 中工作的操作
- 如何从Linuxos中的Python脚本运行/停止C程序
- C++中的Python样式变量
- DLL(C )视觉工作室中的Python
- 嵌入在c中的Python.正在调用pyrun_simplestring同步
- libclang:添加编译器系统包含路径(Windows中的Python)