python - Boost Python hello 示例给出错误。

标签 python boost boost-python bjam

我一直在尝试让 Boost.Python 运行。我正在按照此处提到的步骤进行操作

http://www.boost.org/doc/libs/1_50_0/libs/python/doc/tutorial/doc/html/python/hello.html

。但是,当我尝试从教程目录运行示例程序时,出现以下错误。 python 脚本 hello.py 也被删除。我如何得到两个我似乎无法纠正的错误。

   C:\boost_1_50_0\libs\python\example\tutorial>b2
notice: no Python configured in user-config.jam
notice: will use default configuration
...patience...
...patience...
...found 1621 targets...
...updating 20 targets...
common.mkdir bin
common.mkdir bin\hello.test
common.mkdir bin\hello.test\msvc-10.0
common.mkdir bin\hello.test\msvc-10.0\debug
common.mkdir bin\hello.test\msvc-10.0\debug\threading-multi
copy hello.py
**The syntax of the command is incorrect.

    copy /b  + this-file-does-not-exist-A698EE7806899E69 "hello.py" "bin\hello.t
est\msvc-10.0\debug\threading-multi\hello.py"

...failed copy hello.py bin\hello.test\msvc-10.0\debug\threading-multi\hello.py.
..
...removing hello.py**
common.mkdir bin\msvc-10.0
common.mkdir bin\msvc-10.0\debug
common.mkdir bin\msvc-10.0\debug\threading-multi
compile-c-c++ bin\msvc-10.0\debug\threading-multi\hello.obj
hello.cpp
msvc.link.dll ..\..\..\..\bin.v2\libs\python\build\msvc-10.0\debug\threading-mul
ti\boost_python-vc100-mt-gd-1_50.dll
**LINK : fatal error LNK1104: cannot open file 'python32.lib'**

        call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.b
at" x86 >nul
link /NOLOGO /INCREMENTAL:NO /DLL /DEBUG /MACHINE:X86 /subsystem:console /out:".
.\..\..\..\bin.v2\libs\python\build\msvc-10.0\debug\threading-multi\boost_python
-vc100-mt-gd-1_50.dll" /IMPLIB:"..\..\..\..\bin.v2\libs\python\build\msvc-10.0\d
ebug\threading-multi\boost_python-vc100-mt-gd-1_50.lib" /LIBPATH:"C:\Python33\li
bs"   @"..\..\..\..\bin.v2\libs\python\build\msvc-10.0\debug\threading-multi\boo
st_python-vc100-mt-gd-1_50.dll.rsp"
        if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL%

...failed msvc.link.dll ..\..\..\..\bin.v2\libs\python\build\msvc-10.0\debug\thr
eading-multi\boost_python-vc100-mt-gd-1_50.dll ..\..\..\..\bin.v2\libs\python\bu
ild\msvc-10.0\debug\threading-multi\boost_python-vc100-mt-gd-1_50.lib ..\..\..\.
.\bin.v2\libs\python\build\msvc-10.0\debug\threading-multi\boost_python-vc100-mt
-gd-1_50.pdb...
...skipped <pbin\msvc-10.0\debug\threading-multi>hello_ext.pyd for lack of <p..\
..\..\..\bin.v2\libs\python\build\msvc-10.0\debug\threading-multi>boost_python-v
c100-mt-gd-1_50.lib...
.......
.......

...failed updating 4 targets...
...skipped 7 targets...
...updated 9 targets...

C:\boost_1_50_0\libs\python\example\tutorial>

我的Python版本是

C:\boost_1_50_0\libs\python\example\tutorial>python
Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:57:17) [MSC v.1600 64 bit (AM
D64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> python --version

我安装了旧版本的 Python32,但它似乎一直在搜索它。我的 PYTHON_INLCUDE 和 PYTHON_LIBRARY 都指向新的 python 以及 PATH 环境变量。

C:\boost_1_50_0\libs\python\example\tutorial> echo %python_lib%\
C:\Python33\libs\python33.lib\

C:\boost_1_50_0\libs\python\example\tutorial> echo %python_include%\
C:\Python33\include\

C:\boost_1_50_0\libs\python\example\tutorial>

为什么 hello.py 文件不断被删除:(以及什么系统税不正确

最佳答案

您必须设置配置您的 user-config.jam 文件。 Boost.Python 似乎只找到你的 Python 3.2 版本。您将在主目录 (ECHO %HOMEDRIVE%%HOMEPATH%) 中找到 user-config.jam 文件,或者在 boost 根目录中搜索“user-config.jam”文件。

您必须修改此文件以供使用,如下所示(这只是一个示例):

MSVC 配置(如果您使用 MSVC)

# -------------------
# 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配置

# ---------------------
# 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
    ;

关于python - Boost Python hello 示例给出错误。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13995291/

相关文章:

python - 从 sympy 表达式生成 python 代码?

python - 如何在文件中密集存储大量数字?

c++ - 维护一个对象容器,该容器按该对象的成员与其邻居的成员之间的差异排序

c++ - boost named_semaphore 示例?

c++ - 如何用 Boost::python 包装派生模板类?

python - 数据如何连接到特定的用户 ID?

python - Django:手动获取一个URL对应的 View

c++ - 构建具有特定名称的boost库

python - Boost.Python 因静态库而失败

python - 使用Boost Python Numpy ndarray作为类成员变量