构建Boost.Python [英] Building Boost.Python

查看:125
本文介绍了构建Boost.Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试根据官方网站上的说明构建Boost.Python.

I am trying to build Boost.Python according to the instructions on the official website.

我的操作系统是Windows 7 64位,编译器是MSVC11,boost是1.54.

My OS is Windows 7 64-bit, the compiler is MSVC11, the boost is 1.54.

====================================

=================== Install Boost ==================

要安装基本的Boost,我从其网站下载了boost库,并将其解压缩到本地磁盘.路径为C:\local\boost_1_54_0.

To install basic Boost, I downloaded the boost library from its website, unzip it to my local disk. The path is C:\local\boost_1_54_0.

===============安装Boost.Python ==============

=============== Install Boost.Python ===============

然后我发现Boost.Python需要单独构建.因此,我遵循了 Boost.Python指令.

I then find that Boost.Python need to be built separately. So I followed the Boost.Python instruction.

===============安装Boost.Build ===============

=============== Install Boost.Build ================

在阶段3.1.2中, Boost.Build 是必需的.因此,我再次按照步骤操作,并在C:\local\boost_1_54_0\BoostBuild处安装Boost.Build,并将C:\local\boost_1_54_0\BoostBuild\bin添加到Path环境变量中.

And at stage 3.1.2, Boost.Build is required. So I, again, followed the steps and install Boost.Build at C:\local\boost_1_54_0\BoostBuild, and added C:\local\boost_1_54_0\BoostBuild\bin into the Path enviroment variable.

然后我被困在3.1.3和3.1.4阶段,指令中说

Then I am stuck at stage 3.1.3 and 3.1.4, where the instruction says

3.cd进入Boost安装的libs/python/example/quickstart/目录,其中包含一个小的示例项目.

3.cd into the libs/python/example/quickstart/ directory of your Boost installation, which contains a small example project.

4.调用bjam.将《入门指南》第5节中的示例调用中的"stage"自变量替换为"test",以 建立所有测试目标.还将参数"--verbose-test"添加到 查看测试在运行时生成的输出.

4.Invoke bjam. Replace the "stage" argument from the example invocation from section 5 of the Getting Started Guide with "test," to build all the test targets. Also add the argument "--verbose-test" to see the output generated by the tests when they are run.

在Windows上,您的bjam调用可能类似于:

On Windows, your bjam invocation might look something like:

C:\ boost_1_34_0 \ ... \ quickstart> bjam toolset = msvc --verbose-test test

C:\boost_1_34_0\…\quickstart> bjam toolset=msvc --verbose-test test

我已经输入了指令告诉我的命令行,并且我确定自己在正确的目录中.但是,quickstart文件夹中没有bjamb2(它们位于Boost和C:\ local \ boost_1_54_0 \ BoostBuild \ bin的根目录下).

I've typed the command line that the instruction told me and I am sure that I am in the right directory. However, there is no bjam or b2 in the quickstart folder (they are at the root direcroty of Boost and C:\local\boost_1_54_0\BoostBuild\bin).

我什至试图将这两个文件复制到quickstart文件夹,但是根本不起作用.

I even tried to copy these two files to the quickstart folder, but doesn't work at all.

我对Windows管理机制不是很熟悉,因此不确定Path是否是我的问题的关键.我想在将bin文件夹添加到PATH后,操作系统会自动将我的bjam toolset=msvc --verbose-test test链接到C:\local\boost_1_54_0\BoostBuild\bin文件夹中的bjam吗?

I am not very familiar with the Windows management mechanism, thus am not sure if the Path is the key to my question. I guess after I added the bin folder to the PATH, the OS will automatically link my bjam toolset=msvc --verbose-test test to the bjam in the C:\local\boost_1_54_0\BoostBuild\bin folder?

有人可以帮我吗? :)

Can anyone help me with this? :)

推荐答案

1.)解压缩boost_1_55_0.zip

1.) Unzip boost_1_55_0.zip

2.)准备使用Boost库二进制文件

2.) Prepare to use the Boost Library Binaries

转到boost_1_55_0根目录并打开命令提示符并键入以下命令:

Go to the boost_1_55_0 root directory and open a command prompt and type following commands:

Bootstrap

3.)找到user-config.jam:

3.) Find user-config.jam:

在命令提示符下键入以下内容:

Type following in the command prompt:

ECHO %HOMEDRIVE%%HOMEPATH%

4.)如果user-config.jam在您的homedrive目录中,请按照以下步骤在其中进行更改:

4.) If the user-config.jam is in your homedrive directory please change it there as followed:

注意:

.jam语言将空白"作为参数的分隔!

The .jam language rates a "whitespace" as a separation of arguments!

# -------------------
# MSVC configuration.
# -------------------

# Configure msvc (default version, searched for in standard locations and PATH).
# using msvc ;

# Configure specific msvc version (searched for in standard locations and PATH).
using msvc : 10.0 : C:\\app\\tools\\MSVisualStudio2010\\VC\\bin\\cl.exe ;

….

# ---------------------
# Python configuration.
# ---------------------

# Configure specific Python version.
# using python : 3.1 : /usr/bin/python3 : /usr/include/python3.1 : /usr/lib ;

using python 
    : 2.5                   # Version
    : C:\\app\\tools\\Python25\\python.exe      # Python Path
    : C:\\app\\tools\\Python25\\include         # include path
    : C:\\app\\tools\\Python25\\libs            # lib path(s)
    : <define>BOOST_ALL_NO_LIB=1
    ;

5.)在配置之后构建库!

5.) Build the Libraries AFTER configuration!!

转到boost_1_55_0根目录并打开命令提示符并键入以下命令:

Go to the boost_1_55_0 root directory and open a command prompt and type following commands:

.\b2

6.)将user-config.jam复制到\ boost_1_55_0 \ libs \ python \ example \ tutorial

6.) Copy the user-config.jam to \boost_1_55_0\libs\python\example\tutorial

7.)进一步转到\ boost_1_55_0 \ stage \ lib \

7.) Go further to \boost_1_55_0\stage\lib\

将libboost_python-vc100-mt-gd-1_55.lib重命名为boost_python-vc100-mt-gd-1_55.lib并将其复制到

Rename libboost_python-vc100-mt-gd-1_55.lib to boost_python-vc100-mt-gd-1_55.lib and copy it to

\boost_1_55_0\libs\python\example\tutorial

8.)现在,所有这些文件都应该放在\ boost_1_55_0 \ libs \ python \ example \ tutorial目录中

8.) Now you should have all of these files in the \boost_1_55_0\libs\python\example\tutorial directory

hello.cpp
hello.py
user-config.jam
Jamroot
boost_python-vc100-mt-gd-1_55.lib
bjam.exe

9.)在\ boost_1_55_0 \ libs \ python \ example \ tutorial

9.) Open a command prompt in \boost_1_55_0\libs\python\example\tutorial

然后输入以下命令:

bjam

10.)成功构建之后..

10.) After successful building..

您应该在目录中拥有此文件:

You should have this file in the directory:

hello_ext.dll

将此文件重命名为:

hello_ext.pyd

这篇关于构建Boost.Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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