无法运行bjam来编译boost python教程 [英] Can't run bjam to compile boost python tutorial
问题描述
我想尝试关注本教程包装C ++代码为python为Windows.I安装python.Downloaded最新版本的boost(1_55).First我运行bootstrap.bat来构建bjam.exe.Next,我配置boost_1_55_0 \\ \\ tools \build\v2\user-config.jam使用msvc10编译器并添加了python安装的路径。
现在,根据教程:
I am trying to follow this tutorial on wrapping C++ code for python for Windows.I installed python.Downloaded the latest version of boost(1_55).First I ran bootstrap.bat to build bjam.exe.Next, I configured boost_1_55_0\tools\build\v2\user-config.jam to use msvc10 compiler and added the path to python installation. Now,based on the tutorial :
现在我们准备好了...请务必cd到libs / python / example / tutorial
其中的教程hello.cpp和Jamroot位于。
Now we are ready... Be sure to cd to libs/python/example/tutorial where the tutorial "hello.cpp" and the "Jamroot" is situated.
最后:
bjam
尝试在该目录中运行bjam时会出现:bjam无法识别为内部或外部命令错误我在这里错过了什么?是否user-config.jam驻留在另一个位置?或bjam添加到系统路径?
Trying to run bjam in that directory gives me : "bjam is not recognized as internal or external command" error.What have I missed here? Should user-config.jam reside in another location?Or bjam added to system path?
UPDATE:
Ok。感谢@john我不得不将bjam添加到系统路径。现在,运行它,hello_ext.lib是在 \boost_1_55_0\libs\python\example\\ \\ tutorial \bin \ msvc-11.0 \debug 但不是DLL.Based在教程我应该得到DLL文件的extension.Now,我不知道如何python链接扩展。但如果我假设它确实像C ++那么它应该与hello_ext.lib链接。如果运行:
Ok.Thanks to @john I had to add bjam to system path.But now,running it,hello_ext.lib is created in \boost_1_55_0\libs\python\example\tutorial\bin\msvc-11.0\debug but not DLL.Based on the tutorial I should get DLL file for the extension.Now, I am not sure how python links with extension.But if I assume it does like C++ then it should have linked with hello_ext.lib.But if run :
python hello.py
python hello.py
其中包含从扩展中导入的方法,python运行时崩溃。没有一个关于这个工作流程的全面教程。Boost doc完全对这个。 p>
which contains imported method from the extension ,the python runtime crashes.Isn't there a comprehensive tutorial on this workflow?Boost doc sucks completely on this.
推荐答案
这适用于我:
1。)unzip 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
7.)进一步到\boost_1_55_0\stage\lib\
6.) Copy the user-config.jam to \boost_1_55_0\libs\python\example\tutorial 7.) Go further to \boost_1_55_0\stage\lib\
重命名libboost_python-vc100-mt-gd-1_55。 lib to 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\教学目录
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
这篇关于无法运行bjam来编译boost python教程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!